Update app.py
Browse files
app.py
CHANGED
|
@@ -93,6 +93,7 @@ def infer_video_depth(
|
|
| 93 |
os.makedirs(output_dir)
|
| 94 |
|
| 95 |
# Save the preprocessed (RGB) video and the generated depth visualization.
|
|
|
|
| 96 |
processed_video_path = os.path.join(output_dir, os.path.splitext(video_name)[0] + '_src.mp4')
|
| 97 |
depth_vis_path = os.path.join(output_dir, os.path.splitext(video_name)[0] + '_vis.mp4')
|
| 98 |
save_video(frames, processed_video_path, fps=fps)
|
|
@@ -163,8 +164,8 @@ def infer_video_depth(
|
|
| 163 |
gc.collect()
|
| 164 |
torch.cuda.empty_cache()
|
| 165 |
|
| 166 |
-
#
|
| 167 |
-
return [
|
| 168 |
|
| 169 |
def construct_demo():
|
| 170 |
with gr.Blocks(analytics_enabled=False) as demo:
|
|
@@ -178,8 +179,7 @@ def construct_demo():
|
|
| 178 |
input_video = gr.Video(label="Input Video")
|
| 179 |
with gr.Column(scale=2):
|
| 180 |
with gr.Row(equal_height=True):
|
| 181 |
-
# Removed
|
| 182 |
-
processed_video = gr.Video(label="Preprocessed Video", interactive=False, autoplay=True, show_share_button=True, scale=5)
|
| 183 |
depth_vis_video = gr.Video(label="Generated Depth Video", interactive=False, autoplay=True, show_share_button=True, scale=5)
|
| 184 |
stitched_video = gr.Video(label="Stitched RGBD Video", interactive=False, autoplay=True, show_share_button=True, scale=5)
|
| 185 |
|
|
@@ -202,7 +202,7 @@ def construct_demo():
|
|
| 202 |
generate_btn.click(
|
| 203 |
fn=infer_video_depth,
|
| 204 |
inputs=[input_video, max_len, target_fps, max_res, stitch_option, grayscale_option, convert_from_color_option, blur_slider],
|
| 205 |
-
outputs=[
|
| 206 |
)
|
| 207 |
|
| 208 |
return demo
|
|
|
|
| 93 |
os.makedirs(output_dir)
|
| 94 |
|
| 95 |
# Save the preprocessed (RGB) video and the generated depth visualization.
|
| 96 |
+
# Still process the video, but we won't display it in the UI
|
| 97 |
processed_video_path = os.path.join(output_dir, os.path.splitext(video_name)[0] + '_src.mp4')
|
| 98 |
depth_vis_path = os.path.join(output_dir, os.path.splitext(video_name)[0] + '_vis.mp4')
|
| 99 |
save_video(frames, processed_video_path, fps=fps)
|
|
|
|
| 164 |
gc.collect()
|
| 165 |
torch.cuda.empty_cache()
|
| 166 |
|
| 167 |
+
# Only return the depth visualization and stitched video (not the preprocessed video)
|
| 168 |
+
return [depth_vis_path, stitched_video_path]
|
| 169 |
|
| 170 |
def construct_demo():
|
| 171 |
with gr.Blocks(analytics_enabled=False) as demo:
|
|
|
|
| 179 |
input_video = gr.Video(label="Input Video")
|
| 180 |
with gr.Column(scale=2):
|
| 181 |
with gr.Row(equal_height=True):
|
| 182 |
+
# Removed the processed_video component from the UI
|
|
|
|
| 183 |
depth_vis_video = gr.Video(label="Generated Depth Video", interactive=False, autoplay=True, show_share_button=True, scale=5)
|
| 184 |
stitched_video = gr.Video(label="Stitched RGBD Video", interactive=False, autoplay=True, show_share_button=True, scale=5)
|
| 185 |
|
|
|
|
| 202 |
generate_btn.click(
|
| 203 |
fn=infer_video_depth,
|
| 204 |
inputs=[input_video, max_len, target_fps, max_res, stitch_option, grayscale_option, convert_from_color_option, blur_slider],
|
| 205 |
+
outputs=[depth_vis_video, stitched_video], # Changed to only include the outputs we want to show
|
| 206 |
)
|
| 207 |
|
| 208 |
return demo
|