Improve speed
This commit is contained in:
@@ -10,7 +10,6 @@ from pathlib import Path
|
||||
import yaml
|
||||
|
||||
from app.algo_host.bundle import load_reference_default_config, resolve_reference_bundle_dir
|
||||
from app.algo_host.transcode import ensure_batch_pipeline_input_video
|
||||
from app.consumable_catalog import build_name_mapping
|
||||
|
||||
|
||||
@@ -75,22 +74,17 @@ def prepare_batch_job(
|
||||
*,
|
||||
bundle_dir: Path | None,
|
||||
cache_dir: Path,
|
||||
uploaded_video_path: Path,
|
||||
pipeline_video_path: Path,
|
||||
candidate_consumables: list[str],
|
||||
) -> BatchJobFiles:
|
||||
root = resolve_reference_bundle_dir(bundle_dir)
|
||||
cache_input_dir = cache_dir / "input"
|
||||
cache_output_dir = cache_dir / "output"
|
||||
cache_work_dir = cache_dir / "work"
|
||||
cache_config_dir = cache_dir / "config"
|
||||
for d in (cache_input_dir, cache_output_dir, cache_work_dir, cache_config_dir):
|
||||
for d in (cache_output_dir, cache_work_dir, cache_config_dir):
|
||||
d.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
cache_input = cache_input_dir / "input.mp4"
|
||||
ensure_batch_pipeline_input_video(
|
||||
source_path=uploaded_video_path,
|
||||
dest_path=cache_input,
|
||||
)
|
||||
pipeline_video = pipeline_video_path.resolve()
|
||||
output_path = cache_output_dir / "result.tsv"
|
||||
excel_path = cache_config_dir / "商品信息表.xlsx"
|
||||
whitelist_path = cache_config_dir / "whitelist.json"
|
||||
@@ -100,7 +94,7 @@ def prepare_batch_job(
|
||||
write_reference_whitelist_json(whitelist_path, candidate_consumables=candidate_consumables)
|
||||
config = build_job_config(
|
||||
bundle_dir=root,
|
||||
video_path=cache_input.resolve(),
|
||||
video_path=pipeline_video,
|
||||
output_path=output_path.resolve(),
|
||||
work_dir=cache_work_dir.resolve(),
|
||||
excel_path=excel_path.resolve(),
|
||||
@@ -116,5 +110,5 @@ def prepare_batch_job(
|
||||
whitelist_path=whitelist_path,
|
||||
output_path=output_path,
|
||||
work_dir=cache_work_dir,
|
||||
input_video_path=cache_input,
|
||||
input_video_path=pipeline_video,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user