KingNish commited on
Commit
03bd99a
1 Parent(s): 05b4e29

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -55,7 +55,7 @@ def process_frame(frame, bg_type, bg, fast_mode, bg_frame_index, background_fram
55
  return frame, bg_frame_index
56
 
57
  @spaces.GPU
58
- def fn(vid, bg_type="Color", bg_image=None, bg_video=None, color="#00FF00", fps=0, video_handling="slow_down", fast_mode=True, max_workers=8):
59
  try:
60
  start_time = time.time() # Start the timer
61
 
@@ -95,8 +95,8 @@ def fn(vid, bg_type="Color", bg_image=None, bg_video=None, color="#00FF00", fps=
95
  for future in futures:
96
  result, bg_frame_index = future.result()
97
  processed_frames.append(result)
98
- elapsed_time = time.time() - start_time
99
- yield result, None, f"Processing frame {len(processed_frames)}... Elapsed time: {elapsed_time:.2f} seconds"
100
 
101
  # Create a new video from the processed frames
102
  processed_video = mp.ImageSequenceClip(processed_frames, fps=fps)
@@ -170,7 +170,7 @@ with gr.Blocks(theme=gr.themes.Ocean()) as demo:
170
  with gr.Column(visible=False) as video_handling_options:
171
  video_handling_radio = gr.Radio(["slow_down", "loop"], label="Video Handling", value="slow_down", interactive=True)
172
  fast_mode_checkbox = gr.Checkbox(label="Fast Mode (Use BiRefNet_lite)", value=True, interactive=True)
173
- max_workers_slider = gr.Slider( minimum=1, maximum=32, step=1, value=8, label="Max Workers", info="Determines how many Franes to process parallel", interactive=True
174
  )
175
  time_textbox = gr.Textbox(label="Time Elapsed", interactive=False) # Add time textbox
176
 
 
55
  return frame, bg_frame_index
56
 
57
  @spaces.GPU
58
+ def fn(vid, bg_type="Color", bg_image=None, bg_video=None, color="#00FF00", fps=0, video_handling="slow_down", fast_mode=True, max_workers=5):
59
  try:
60
  start_time = time.time() # Start the timer
61
 
 
95
  for future in futures:
96
  result, bg_frame_index = future.result()
97
  processed_frames.append(result)
98
+ elapsed_time = time.time() - start_time
99
+ yield result, None, f"Processing frame {len(processed_frames)}... Elapsed time: {elapsed_time:.2f} seconds"
100
 
101
  # Create a new video from the processed frames
102
  processed_video = mp.ImageSequenceClip(processed_frames, fps=fps)
 
170
  with gr.Column(visible=False) as video_handling_options:
171
  video_handling_radio = gr.Radio(["slow_down", "loop"], label="Video Handling", value="slow_down", interactive=True)
172
  fast_mode_checkbox = gr.Checkbox(label="Fast Mode (Use BiRefNet_lite)", value=True, interactive=True)
173
+ max_workers_slider = gr.Slider( minimum=1, maximum=32, step=1, value=5, label="Max Workers", info="Determines how many Franes to process parallel", interactive=True
174
  )
175
  time_textbox = gr.Textbox(label="Time Elapsed", interactive=False) # Add time textbox
176