Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -12,16 +12,16 @@ from huggingface_hub import hf_hub_download
|
|
12 |
|
13 |
# Examples for the Gradio Demo
|
14 |
examples = [
|
15 |
-
['assets/example_videos/davis_rollercoaster.mp4', -1, -1, 1280],
|
16 |
-
['assets/example_videos/Tokyo-Walk_rgb.mp4', -1, -1, 1280],
|
17 |
-
['assets/example_videos/4158877-uhd_3840_2160_30fps_rgb.mp4', -1, -1, 1280],
|
18 |
-
['assets/example_videos/4511004-uhd_3840_2160_24fps_rgb.mp4', -1, -1, 1280],
|
19 |
-
['assets/example_videos/1753029-hd_1920_1080_30fps.mp4', -1, -1, 1280],
|
20 |
-
['assets/example_videos/davis_burnout.mp4', -1, -1, 1280],
|
21 |
-
['assets/example_videos/example_5473765-l.mp4', -1, -1, 1280],
|
22 |
-
['assets/example_videos/Istanbul-26920.mp4', -1, -1, 1280],
|
23 |
-
['assets/example_videos/obj_1.mp4', -1, -1, 1280],
|
24 |
-
['assets/example_videos/sheep_cut1.mp4', -1, -1, 1280],
|
25 |
]
|
26 |
|
27 |
DEVICE = 'cuda' if torch.cuda.is_available() else 'cpu'
|
@@ -59,11 +59,12 @@ def infer_video_depth(
|
|
59 |
max_len: int = -1,
|
60 |
target_fps: int = -1,
|
61 |
max_res: int = 1280,
|
62 |
-
output_dir: str = './outputs',
|
63 |
-
input_size: int = 518,
|
64 |
stitch: bool = False,
|
65 |
grayscale: bool = False,
|
66 |
blur: float = 0.0,
|
|
|
|
|
|
|
67 |
):
|
68 |
# Read input video frames
|
69 |
frames, target_fps = read_video_frames(input_video, max_len, target_fps, max_res)
|
@@ -122,8 +123,8 @@ def construct_demo():
|
|
122 |
|
123 |
with gr.Row(equal_height=True):
|
124 |
with gr.Column(scale=1):
|
125 |
-
#
|
126 |
-
input_video = gr.Video(label="Input Video")
|
127 |
with gr.Column(scale=2):
|
128 |
with gr.Row(equal_height=True):
|
129 |
processed_video = gr.Video(label="Preprocessed Video", interactive=False, autoplay=True, loop=True, show_share_button=True, scale=5)
|
|
|
12 |
|
13 |
# Examples for the Gradio Demo
|
14 |
examples = [
|
15 |
+
['assets/example_videos/davis_rollercoaster.mp4', -1, -1, 1280, False, False, 0],
|
16 |
+
['assets/example_videos/Tokyo-Walk_rgb.mp4', -1, -1, 1280, False, False, 0],
|
17 |
+
['assets/example_videos/4158877-uhd_3840_2160_30fps_rgb.mp4', -1, -1, 1280, False, False, 0],
|
18 |
+
['assets/example_videos/4511004-uhd_3840_2160_24fps_rgb.mp4', -1, -1, 1280, False, False, 0],
|
19 |
+
['assets/example_videos/1753029-hd_1920_1080_30fps.mp4', -1, -1, 1280, False, False, 0],
|
20 |
+
['assets/example_videos/davis_burnout.mp4', -1, -1, 1280, False, False, 0],
|
21 |
+
['assets/example_videos/example_5473765-l.mp4', -1, -1, 1280, False, False, 0],
|
22 |
+
['assets/example_videos/Istanbul-26920.mp4', -1, -1, 1280, False, False, 0],
|
23 |
+
['assets/example_videos/obj_1.mp4', -1, -1, 1280, False, False, 0],
|
24 |
+
['assets/example_videos/sheep_cut1.mp4', -1, -1, 1280, False, False, 0],
|
25 |
]
|
26 |
|
27 |
DEVICE = 'cuda' if torch.cuda.is_available() else 'cpu'
|
|
|
59 |
max_len: int = -1,
|
60 |
target_fps: int = -1,
|
61 |
max_res: int = 1280,
|
|
|
|
|
62 |
stitch: bool = False,
|
63 |
grayscale: bool = False,
|
64 |
blur: float = 0.0,
|
65 |
+
*, # Ab hier folgen keyword-only Parameter:
|
66 |
+
output_dir: str = './outputs',
|
67 |
+
input_size: int = 518,
|
68 |
):
|
69 |
# Read input video frames
|
70 |
frames, target_fps = read_video_frames(input_video, max_len, target_fps, max_res)
|
|
|
123 |
|
124 |
with gr.Row(equal_height=True):
|
125 |
with gr.Column(scale=1):
|
126 |
+
# Verwende hier source="upload" für das Datei-Upload-Feld
|
127 |
+
input_video = gr.Video(label="Input Video", source="upload")
|
128 |
with gr.Column(scale=2):
|
129 |
with gr.Row(equal_height=True):
|
130 |
processed_video = gr.Video(label="Preprocessed Video", interactive=False, autoplay=True, loop=True, show_share_button=True, scale=5)
|