KingNish commited on
Commit
73805ba
·
verified ·
1 Parent(s): e5e4f17

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -2
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
- # Yield the first processed image from the current batch
143
- yield processed_frames[-len(threads) if threads else -frame_batch_size], None, f"Processing frame {i+1}... Elapsed time: {elapsed_time:.2f} seconds"
 
 
 
 
 
 
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)