Update app.py
Browse files
app.py
CHANGED
@@ -4,6 +4,28 @@ os.environ["HF_HOME"] = "/tmp/huggingface"
|
|
4 |
os.environ["TRANSFORMERS_CACHE"] = "/tmp/huggingface/transformers"
|
5 |
os.environ["MPLCONFIGDIR"] = "/tmp/matplotlib"
|
6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
import gc
|
8 |
import torch
|
9 |
import cv2
|
@@ -156,7 +178,7 @@ def construct_demo():
|
|
156 |
input_video = gr.Video(label="Input Video")
|
157 |
with gr.Column(scale=2):
|
158 |
with gr.Row(equal_height=True):
|
159 |
-
# Removed
|
160 |
processed_video = gr.Video(label="Preprocessed Video", interactive=False, autoplay=True, show_share_button=True, scale=5)
|
161 |
depth_vis_video = gr.Video(label="Generated Depth Video", interactive=False, autoplay=True, show_share_button=True, scale=5)
|
162 |
stitched_video = gr.Video(label="Stitched RGBD Video", interactive=False, autoplay=True, show_share_button=True, scale=5)
|
@@ -175,7 +197,7 @@ def construct_demo():
|
|
175 |
with gr.Column(scale=2):
|
176 |
pass
|
177 |
|
178 |
-
# Examples
|
179 |
|
180 |
generate_btn.click(
|
181 |
fn=infer_video_depth,
|
|
|
4 |
os.environ["TRANSFORMERS_CACHE"] = "/tmp/huggingface/transformers"
|
5 |
os.environ["MPLCONFIGDIR"] = "/tmp/matplotlib"
|
6 |
|
7 |
+
# Patching the schema handling problem in Gradio 5.x
|
8 |
+
# This needs to be done before any Gradio imports
|
9 |
+
import sys
|
10 |
+
def patch_gradio_utils():
|
11 |
+
try:
|
12 |
+
from gradio_client import utils
|
13 |
+
original_get_type = utils.get_type
|
14 |
+
|
15 |
+
def patched_get_type(schema):
|
16 |
+
if isinstance(schema, bool):
|
17 |
+
return "boolean"
|
18 |
+
if not isinstance(schema, dict):
|
19 |
+
return "any"
|
20 |
+
return original_get_type(schema)
|
21 |
+
|
22 |
+
utils.get_type = patched_get_type
|
23 |
+
print("Successfully patched Gradio utils.get_type")
|
24 |
+
except Exception as e:
|
25 |
+
print(f"Could not patch Gradio utils: {e}")
|
26 |
+
|
27 |
+
patch_gradio_utils()
|
28 |
+
|
29 |
import gc
|
30 |
import torch
|
31 |
import cv2
|
|
|
178 |
input_video = gr.Video(label="Input Video")
|
179 |
with gr.Column(scale=2):
|
180 |
with gr.Row(equal_height=True):
|
181 |
+
# Removed unsupported parameters for Gradio 5.x
|
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)
|
|
|
197 |
with gr.Column(scale=2):
|
198 |
pass
|
199 |
|
200 |
+
# Removed Examples block to improve loading time
|
201 |
|
202 |
generate_btn.click(
|
203 |
fn=infer_video_depth,
|