Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -139,8 +139,14 @@ def fn(vid, bg_type="Color", bg_image=None, bg_video=None, color="#00FF00", fps=
|
|
139 |
threads = [] # Reset the threads list
|
140 |
|
141 |
elapsed_time = time.time() - start_time
|
142 |
-
|
143 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
144 |
|
145 |
# Create a new video from the processed frames
|
146 |
processed_video = mp.ImageSequenceClip(processed_frames, fps=fps)
|
|
|
139 |
threads = [] # Reset the threads list
|
140 |
|
141 |
elapsed_time = time.time() - start_time
|
142 |
+
|
143 |
+
# Yield the first processed image from the current batch if available
|
144 |
+
if processed_frames:
|
145 |
+
index = -len(threads) if threads else -min(frame_batch_size, len(processed_frames))
|
146 |
+
yield processed_frames[index], None, f"Processing frame {i+1}... Elapsed time: {elapsed_time:.2f} seconds"
|
147 |
+
else:
|
148 |
+
yield None, None, f"Processing frame {i+1}... Elapsed time: {elapsed_time:.2f} seconds"
|
149 |
+
|
150 |
|
151 |
# Create a new video from the processed frames
|
152 |
processed_video = mp.ImageSequenceClip(processed_frames, fps=fps)
|