Update app.py
Browse files
app.py
CHANGED
@@ -69,6 +69,7 @@ def infer_video_depth(
|
|
69 |
max_len: int = -1,
|
70 |
target_fps: int = -1,
|
71 |
max_res: int = 1280,
|
|
|
72 |
output_dir: str = './outputs',
|
73 |
input_size: int = 518,
|
74 |
):
|
@@ -82,7 +83,7 @@ def infer_video_depth(
|
|
82 |
processed_video_path = os.path.join(output_dir, os.path.splitext(video_name)[0]+'_src.mp4')
|
83 |
depth_vis_path = os.path.join(output_dir, os.path.splitext(video_name)[0]+'_vis.mp4')
|
84 |
save_video(frames, processed_video_path, fps=fps)
|
85 |
-
save_video(depths, depth_vis_path, fps=fps, is_depths=True)
|
86 |
|
87 |
gc.collect()
|
88 |
torch.cuda.empty_cache()
|
@@ -145,6 +146,10 @@ def construct_demo():
|
|
145 |
value=1280,
|
146 |
step=1,
|
147 |
)
|
|
|
|
|
|
|
|
|
148 |
generate_btn = gr.Button("Generate")
|
149 |
with gr.Column(scale=2):
|
150 |
pass
|
@@ -168,7 +173,8 @@ def construct_demo():
|
|
168 |
input_video,
|
169 |
max_len,
|
170 |
target_fps,
|
171 |
-
max_res
|
|
|
172 |
],
|
173 |
outputs=[processed_video, depth_vis_video],
|
174 |
)
|
|
|
69 |
max_len: int = -1,
|
70 |
target_fps: int = -1,
|
71 |
max_res: int = 1280,
|
72 |
+
grayscale: bool = False,
|
73 |
output_dir: str = './outputs',
|
74 |
input_size: int = 518,
|
75 |
):
|
|
|
83 |
processed_video_path = os.path.join(output_dir, os.path.splitext(video_name)[0]+'_src.mp4')
|
84 |
depth_vis_path = os.path.join(output_dir, os.path.splitext(video_name)[0]+'_vis.mp4')
|
85 |
save_video(frames, processed_video_path, fps=fps)
|
86 |
+
save_video(depths, depth_vis_path, fps=fps, is_depths=True, grayscale=grayscale)
|
87 |
|
88 |
gc.collect()
|
89 |
torch.cuda.empty_cache()
|
|
|
146 |
value=1280,
|
147 |
step=1,
|
148 |
)
|
149 |
+
grayscale = gr.Checkbox(
|
150 |
+
label="grayscale",
|
151 |
+
value=False,
|
152 |
+
)
|
153 |
generate_btn = gr.Button("Generate")
|
154 |
with gr.Column(scale=2):
|
155 |
pass
|
|
|
173 |
input_video,
|
174 |
max_len,
|
175 |
target_fps,
|
176 |
+
max_res,
|
177 |
+
grayscale
|
178 |
],
|
179 |
outputs=[processed_video, depth_vis_video],
|
180 |
)
|