Improve speed

This commit is contained in:
Kevin
2026-05-22 11:15:22 +08:00
parent 87b6a7b804
commit 941c71e991
14 changed files with 132 additions and 49 deletions

View File

@@ -190,8 +190,17 @@ def normalize_batch_input_video(source_path: Path, output_path: Path) -> bool:
return True
def stage_batch_pipeline_input(*, source_path: Path, dest_path: Path) -> None:
"""Copy upload to digest-level pipeline input without browser normalize/transcode."""
dest_path.parent.mkdir(parents=True, exist_ok=True)
if dest_path.is_file() and dest_path.stat().st_size > 0:
return
shutil.copy2(source_path, dest_path)
def ensure_batch_pipeline_input_video(*, source_path: Path, dest_path: Path) -> None:
import shutil as sh
"""Browser-compatible normalize/copy; use only for visualization inputs, not batch inference."""
dest_path.parent.mkdir(parents=True, exist_ok=True)
if dest_path.is_file() and dest_path.stat().st_size > 0 and not batch_input_needs_normalize(dest_path):
@@ -205,7 +214,7 @@ def ensure_batch_pipeline_input_video(*, source_path: Path, dest_path: Path) ->
dest_path,
)
if not dest_path.is_file():
sh.copy2(source_path, dest_path)
shutil.copy2(source_path, dest_path)
def transcode_visualization_for_browser(source_path: Path, output_path: Path) -> bool: