Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -108,13 +108,23 @@ def process_video(
|
|
| 108 |
output_dir = Path(tempfile.mkdtemp(prefix="shortsmith_output_"))
|
| 109 |
log(f"Output directory: {output_dir}")
|
| 110 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 111 |
# Initialize pipeline
|
| 112 |
progress(0.1, desc="Initializing AI models...")
|
| 113 |
log("Initializing pipeline...")
|
| 114 |
-
pipeline = PipelineOrchestrator()
|
| 115 |
|
| 116 |
# Process video
|
| 117 |
-
progress(0.
|
| 118 |
log(f"Processing: {int(num_clips)} clips @ {int(clip_duration)}s each")
|
| 119 |
|
| 120 |
result = pipeline.process(
|
|
@@ -252,7 +262,7 @@ with gr.Blocks(
|
|
| 252 |
clip2_output = gr.Video(label="Clip 2", elem_classes=["output-video"])
|
| 253 |
clip3_output = gr.Video(label="Clip 3", elem_classes=["output-video"])
|
| 254 |
|
| 255 |
-
with gr.Accordion("📋 Processing Log", open=
|
| 256 |
log_output = gr.Textbox(
|
| 257 |
label="Log",
|
| 258 |
lines=10,
|
|
|
|
| 108 |
output_dir = Path(tempfile.mkdtemp(prefix="shortsmith_output_"))
|
| 109 |
log(f"Output directory: {output_dir}")
|
| 110 |
|
| 111 |
+
# Progress callback to update UI during processing
|
| 112 |
+
def on_progress(pipeline_progress):
|
| 113 |
+
stage = pipeline_progress.stage.value
|
| 114 |
+
pct = pipeline_progress.progress
|
| 115 |
+
msg = pipeline_progress.message
|
| 116 |
+
log(f"[{stage}] {msg}")
|
| 117 |
+
# Map pipeline progress (0-1) to our range (0.1-0.9)
|
| 118 |
+
mapped_progress = 0.1 + (pct * 0.8)
|
| 119 |
+
progress(mapped_progress, desc=f"{stage}: {msg}")
|
| 120 |
+
|
| 121 |
# Initialize pipeline
|
| 122 |
progress(0.1, desc="Initializing AI models...")
|
| 123 |
log("Initializing pipeline...")
|
| 124 |
+
pipeline = PipelineOrchestrator(progress_callback=on_progress)
|
| 125 |
|
| 126 |
# Process video
|
| 127 |
+
progress(0.15, desc="Starting analysis...")
|
| 128 |
log(f"Processing: {int(num_clips)} clips @ {int(clip_duration)}s each")
|
| 129 |
|
| 130 |
result = pipeline.process(
|
|
|
|
| 262 |
clip2_output = gr.Video(label="Clip 2", elem_classes=["output-video"])
|
| 263 |
clip3_output = gr.Video(label="Clip 3", elem_classes=["output-video"])
|
| 264 |
|
| 265 |
+
with gr.Accordion("📋 Processing Log", open=True):
|
| 266 |
log_output = gr.Textbox(
|
| 267 |
label="Log",
|
| 268 |
lines=10,
|