mtwohey2 commited on
Commit
4a8d08c
·
verified ·
1 Parent(s): 3ed85f1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -107,6 +107,10 @@ def stitch_rgbd_videos(
107
  # Now safely concatenate.
108
  stitched = cv2.hconcat([rgb_full, depth_vis_resized])
109
  stitched_frames.append(stitched)
 
 
 
 
110
 
111
  stitched_frames = np.array(stitched_frames)
112
  # Use only the first 20 characters of the base name for the output filename and append '_RGBD.mp4'
@@ -154,7 +158,7 @@ def construct_demo():
154
  stitched_video = gr.Video(label="Stitched RGBD Video", interactive=False, autoplay=True, loop=True, show_share_button=True, scale=5)
155
 
156
  with gr.Row(equal_height=True):
157
- with gr.Column(scale=1):
158
  with gr.Accordion("Advanced Settings", open=False):
159
  max_len = gr.Slider(label="Max process length", minimum=-1, maximum=1000, value=-1, step=1)
160
  target_fps = gr.Slider(label="Target FPS", minimum=-1, maximum=30, value=-1, step=1)
@@ -164,7 +168,7 @@ def construct_demo():
164
  convert_from_color_option = gr.Checkbox(label="Convert Grayscale from Color", value=True)
165
  blur_slider = gr.Slider(minimum=0, maximum=1, step=0.01, label="Depth Blur (can reduce edge artifacts on display)", value=0.3)
166
  generate_btn = gr.Button("Generate")
167
- with gr.Column(scale=2):
168
  pass
169
 
170
  generate_btn.click(
 
107
  # Now safely concatenate.
108
  stitched = cv2.hconcat([rgb_full, depth_vis_resized])
109
  stitched_frames.append(stitched)
110
+
111
+ del rgb_full, depth_vis_resized, stitched
112
+ gc.collect() # Force Python to free unused memory
113
+
114
 
115
  stitched_frames = np.array(stitched_frames)
116
  # Use only the first 20 characters of the base name for the output filename and append '_RGBD.mp4'
 
158
  stitched_video = gr.Video(label="Stitched RGBD Video", interactive=False, autoplay=True, loop=True, show_share_button=True, scale=5)
159
 
160
  with gr.Row(equal_height=True):
161
+ with gr.Column(scale=2):
162
  with gr.Accordion("Advanced Settings", open=False):
163
  max_len = gr.Slider(label="Max process length", minimum=-1, maximum=1000, value=-1, step=1)
164
  target_fps = gr.Slider(label="Target FPS", minimum=-1, maximum=30, value=-1, step=1)
 
168
  convert_from_color_option = gr.Checkbox(label="Convert Grayscale from Color", value=True)
169
  blur_slider = gr.Slider(minimum=0, maximum=1, step=0.01, label="Depth Blur (can reduce edge artifacts on display)", value=0.3)
170
  generate_btn = gr.Button("Generate")
171
+ with gr.Column(scale=1):
172
  pass
173
 
174
  generate_btn.click(