Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -103,6 +103,11 @@ def handle(mode, media_upload, url,
|
|
| 103 |
|
| 104 |
first_input = media[0]
|
| 105 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
# --- VIDEO PATH ---
|
| 107 |
if isinstance(first_input, str) and first_input.lower().endswith((".mp4", ".mov", ".avi")):
|
| 108 |
valid, err = validate_video(first_input)
|
|
@@ -117,12 +122,12 @@ def handle(mode, media_upload, url,
|
|
| 117 |
_, msg, output_video_path = process_video(
|
| 118 |
video_path=first_input,
|
| 119 |
run_det=run_det,
|
| 120 |
-
det_model=
|
| 121 |
det_confidence=det_confidence,
|
| 122 |
run_seg=run_seg,
|
| 123 |
-
seg_model=
|
| 124 |
run_depth=run_depth,
|
| 125 |
-
depth_model=
|
| 126 |
blend=blend
|
| 127 |
)
|
| 128 |
return (
|
|
@@ -154,12 +159,12 @@ def handle(mode, media_upload, url,
|
|
| 154 |
result_img, msg, output_zip = process_image(
|
| 155 |
image=first_input,
|
| 156 |
run_det=run_det,
|
| 157 |
-
det_model=
|
| 158 |
det_confidence=det_confidence,
|
| 159 |
run_seg=run_seg,
|
| 160 |
-
seg_model=
|
| 161 |
run_depth=run_depth,
|
| 162 |
-
depth_model=
|
| 163 |
blend=blend
|
| 164 |
)
|
| 165 |
return (
|
|
@@ -195,6 +200,7 @@ def handle(mode, media_upload, url,
|
|
| 195 |
)
|
| 196 |
|
| 197 |
|
|
|
|
| 198 |
def show_preview_from_upload(files):
|
| 199 |
if not files:
|
| 200 |
return gr.update(visible=False), gr.update(visible=False)
|
|
|
|
| 103 |
|
| 104 |
first_input = media[0]
|
| 105 |
|
| 106 |
+
# 🔧 Resolve dropdown label to model keys
|
| 107 |
+
resolved_det_model = DETECTION_MODEL_MAP.get(det_model, det_model)
|
| 108 |
+
resolved_seg_model = SEGMENTATION_MODEL_MAP.get(seg_model, seg_model)
|
| 109 |
+
resolved_depth_model = DEPTH_MODEL_MAP.get(depth_model, depth_model)
|
| 110 |
+
|
| 111 |
# --- VIDEO PATH ---
|
| 112 |
if isinstance(first_input, str) and first_input.lower().endswith((".mp4", ".mov", ".avi")):
|
| 113 |
valid, err = validate_video(first_input)
|
|
|
|
| 122 |
_, msg, output_video_path = process_video(
|
| 123 |
video_path=first_input,
|
| 124 |
run_det=run_det,
|
| 125 |
+
det_model=resolved_det_model,
|
| 126 |
det_confidence=det_confidence,
|
| 127 |
run_seg=run_seg,
|
| 128 |
+
seg_model=resolved_seg_model,
|
| 129 |
run_depth=run_depth,
|
| 130 |
+
depth_model=resolved_depth_model,
|
| 131 |
blend=blend
|
| 132 |
)
|
| 133 |
return (
|
|
|
|
| 159 |
result_img, msg, output_zip = process_image(
|
| 160 |
image=first_input,
|
| 161 |
run_det=run_det,
|
| 162 |
+
det_model=resolved_det_model,
|
| 163 |
det_confidence=det_confidence,
|
| 164 |
run_seg=run_seg,
|
| 165 |
+
seg_model=resolved_seg_model,
|
| 166 |
run_depth=run_depth,
|
| 167 |
+
depth_model=resolved_depth_model,
|
| 168 |
blend=blend
|
| 169 |
)
|
| 170 |
return (
|
|
|
|
| 200 |
)
|
| 201 |
|
| 202 |
|
| 203 |
+
|
| 204 |
def show_preview_from_upload(files):
|
| 205 |
if not files:
|
| 206 |
return gr.update(visible=False), gr.update(visible=False)
|