Release v1.0.0 candidate
This commit is contained in:
@@ -233,14 +233,24 @@ impl PythonExecutor {
|
||||
Ok(())
|
||||
};
|
||||
|
||||
// 錯誤時 rename .json.tmp → .json.err
|
||||
// 錯誤時 rename .json.tmp → .json.err(若 .tmp 非有效 JSON)
|
||||
// 若 .tmp 是有效 JSON,保留為 .json(保留部分結果)
|
||||
let mark_failed = || {
|
||||
if let Some(tmp) = &tmp_path {
|
||||
if tmp.exists() {
|
||||
if let Some(out) = &output_path {
|
||||
let mut err_path = out.to_path_buf();
|
||||
err_path.set_extension("json.err");
|
||||
let _ = std::fs::rename(tmp, &err_path);
|
||||
let is_valid = std::fs::read_to_string(tmp)
|
||||
.ok()
|
||||
.and_then(|c| serde_json::from_str::<serde_json::Value>(&c).ok())
|
||||
.is_some();
|
||||
if is_valid {
|
||||
let _ = std::fs::rename(tmp, out);
|
||||
tracing::warn!("[Executor] Partial output preserved: {:?}", out);
|
||||
} else {
|
||||
let mut err_path = out.to_path_buf();
|
||||
err_path.set_extension("json.err");
|
||||
let _ = std::fs::rename(tmp, &err_path);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,10 +65,17 @@ pub async fn process_scene_classification(
|
||||
});
|
||||
}
|
||||
|
||||
let coreml_path = "/Users/accusys/models/resnet18_places365.mlpackage";
|
||||
let mut args = vec![video_path, output_path];
|
||||
if std::path::Path::new(coreml_path).exists() {
|
||||
args.push("--model");
|
||||
args.push(coreml_path);
|
||||
}
|
||||
|
||||
executor
|
||||
.run(
|
||||
"scene_classifier.py",
|
||||
&[video_path, output_path],
|
||||
&args,
|
||||
uuid,
|
||||
"SCENE",
|
||||
Some(SCENE_TIMEOUT),
|
||||
|
||||
Reference in New Issue
Block a user