Krokodilpirat commited on
Commit
e003b4c
·
verified ·
1 Parent(s): a6304ea

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -15
app.py CHANGED
@@ -12,19 +12,22 @@ from utils.dc_utils import read_video_frames, save_video
12
  from huggingface_hub import hf_hub_download
13
 
14
  # Examples for the Gradio Demo.
15
- # Each example now contains 8 parameters in the following order:
16
  # [video_path, max_len, target_fps, max_res, stitch, grayscale, convert_from_color, blur]
17
  examples = [
18
- ['assets/example_videos/davis_rollercoaster.mp4', -1, -1, 1280, True, True, True, 0.5],
19
- ['assets/example_videos/Tokyo-Walk_rgb.mp4', -1, -1, 1280, True, True, True, 0.5],
20
- ['assets/example_videos/4158877-uhd_3840_2160_30fps_rgb.mp4', -1, -1, 1280, True, True, True, 0.5],
21
- ['assets/example_videos/4511004-uhd_3840_2160_24fps_rgb.mp4', -1, -1, 1280, True, True, True, 0.5],
22
- ['assets/example_videos/1753029-hd_1920_1080_30fps.mp4', -1, -1, 1280, True, True, True, 0.5],
23
- ['assets/example_videos/davis_burnout.mp4', -1, -1, 1280, True, True, True, 0.5],
24
- ['assets/example_videos/example_5473765-l.mp4', -1, -1, 1280, True, True, True, 0.5],
25
- ['assets/example_videos/Istanbul-26920.mp4', -1, -1, 1280, True, True, True, 0.5],
26
- ['assets/example_videos/obj_1.mp4', -1, -1, 1280, True, True, True, 0.5],
27
- ['assets/example_videos/sheep_cut1.mp4', -1, -1, 1280, True, True, True, 0.5],
 
 
 
28
  ]
29
 
30
  # Use GPU if available; otherwise, use CPU.
@@ -64,7 +67,7 @@ def infer_video_depth(
64
  stitch: bool = True,
65
  grayscale: bool = True,
66
  convert_from_color: bool = True,
67
- blur: float = 0.5,
68
  output_dir: str = './outputs',
69
  input_size: int = 518,
70
  ):
@@ -104,7 +107,7 @@ def infer_video_depth(
104
  depth_gray = cv2.cvtColor(depth_color, cv2.COLOR_RGB2GRAY)
105
  depth_vis = np.stack([depth_gray] * 3, axis=-1)
106
  else:
107
- # Directly generate a grayscale image from the normalized depth values.
108
  depth_vis = np.stack([depth_norm] * 3, axis=-1)
109
  else:
110
  # Generate a color depth image using the inferno colormap.
@@ -175,7 +178,7 @@ def construct_demo():
175
  stitch_option = gr.Checkbox(label="Stitch RGB & Depth Videos", value=True)
176
  grayscale_option = gr.Checkbox(label="Output Depth as Grayscale", value=True)
177
  convert_from_color_option = gr.Checkbox(label="Convert Grayscale from Color", value=True)
178
- blur_slider = gr.Slider(minimum=0, maximum=1, step=0.01, label="Depth Blur (can reduce edge artifacts)", value=0.5)
179
  generate_btn = gr.Button("Generate")
180
  with gr.Column(scale=2):
181
  pass
@@ -200,4 +203,4 @@ def construct_demo():
200
  if __name__ == "__main__":
201
  demo = construct_demo()
202
  demo.queue() # Enable asynchronous processing.
203
- demo.launch(share=True)
 
12
  from huggingface_hub import hf_hub_download
13
 
14
  # Examples for the Gradio Demo.
15
+ # Each example now contains 8 parameters:
16
  # [video_path, max_len, target_fps, max_res, stitch, grayscale, convert_from_color, blur]
17
  examples = [
18
+ ['assets/example_videos/octopus_01.mp4', -1, -1, 1280, True, True, True, 0.3],
19
+ ['assets/example_videos/chicken_01.mp4', -1, -1, 1280, True, True, True, 0.3],
20
+ ['assets/example_videos/gorilla_01.mp4', -1, -1, 1280, True, True, True, 0.3],
21
+ ['assets/example_videos/davis_rollercoaster.mp4', -1, -1, 1280, True, True, True, 0.3],
22
+ ['assets/example_videos/Tokyo-Walk_rgb.mp4', -1, -1, 1280, True, True, True, 0.3],
23
+ ['assets/example_videos/4158877-uhd_3840_2160_30fps_rgb.mp4', -1, -1, 1280, True, True, True, 0.3],
24
+ ['assets/example_videos/4511004-uhd_3840_2160_24fps_rgb.mp4', -1, -1, 1280, True, True, True, 0.3],
25
+ ['assets/example_videos/1753029-hd_1920_1080_30fps.mp4', -1, -1, 1280, True, True, True, 0.3],
26
+ ['assets/example_videos/davis_burnout.mp4', -1, -1, 1280, True, True, True, 0.3],
27
+ ['assets/example_videos/example_5473765-l.mp4', -1, -1, 1280, True, True, True, 0.3],
28
+ ['assets/example_videos/Istanbul-26920.mp4', -1, -1, 1280, True, True, True, 0.3],
29
+ ['assets/example_videos/obj_1.mp4', -1, -1, 1280, True, True, True, 0.3],
30
+ ['assets/example_videos/sheep_cut1.mp4', -1, -1, 1280, True, True, True, 0.3],
31
  ]
32
 
33
  # Use GPU if available; otherwise, use CPU.
 
67
  stitch: bool = True,
68
  grayscale: bool = True,
69
  convert_from_color: bool = True,
70
+ blur: float = 0.3,
71
  output_dir: str = './outputs',
72
  input_size: int = 518,
73
  ):
 
107
  depth_gray = cv2.cvtColor(depth_color, cv2.COLOR_RGB2GRAY)
108
  depth_vis = np.stack([depth_gray] * 3, axis=-1)
109
  else:
110
+ # Directly generate a grayscale image from normalized depth.
111
  depth_vis = np.stack([depth_norm] * 3, axis=-1)
112
  else:
113
  # Generate a color depth image using the inferno colormap.
 
178
  stitch_option = gr.Checkbox(label="Stitch RGB & Depth Videos", value=True)
179
  grayscale_option = gr.Checkbox(label="Output Depth as Grayscale", value=True)
180
  convert_from_color_option = gr.Checkbox(label="Convert Grayscale from Color", value=True)
181
+ blur_slider = gr.Slider(minimum=0, maximum=1, step=0.01, label="Depth Blur (can reduce edge artifacts)", value=0.3)
182
  generate_btn = gr.Button("Generate")
183
  with gr.Column(scale=2):
184
  pass
 
203
  if __name__ == "__main__":
204
  demo = construct_demo()
205
  demo.queue() # Enable asynchronous processing.
206
+ demo.launch(share=True)