Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -198,76 +198,76 @@ with gr.Blocks() as demo:
|
|
| 198 |
|
| 199 |
raw_depth = gr.State() # 🔑 保存模型输出
|
| 200 |
|
| 201 |
-
with gr.Row():
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
|
| 209 |
-
|
| 210 |
-
|
| 211 |
-
|
| 212 |
-
|
| 213 |
-
|
| 214 |
-
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
|
| 218 |
-
|
| 219 |
-
|
| 220 |
-
|
| 221 |
-
|
| 222 |
-
|
| 223 |
-
|
| 224 |
-
|
| 225 |
-
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
|
| 233 |
-
|
| 234 |
-
|
| 235 |
-
|
| 236 |
-
|
| 237 |
-
|
| 238 |
-
|
| 239 |
-
|
| 240 |
-
|
| 241 |
-
|
| 242 |
-
|
| 243 |
-
|
| 244 |
-
|
| 245 |
-
|
| 246 |
-
|
| 247 |
-
|
| 248 |
-
|
| 249 |
-
|
| 250 |
-
|
| 251 |
-
|
| 252 |
-
|
| 253 |
-
|
| 254 |
-
|
| 255 |
-
|
| 256 |
-
|
| 257 |
-
|
| 258 |
-
|
| 259 |
-
|
| 260 |
-
|
| 261 |
-
|
| 262 |
-
|
| 263 |
-
|
| 264 |
-
|
| 265 |
-
|
| 266 |
-
|
| 267 |
-
|
| 268 |
-
|
| 269 |
-
|
| 270 |
-
|
| 271 |
|
| 272 |
|
| 273 |
# 1️⃣ 跑模型
|
|
|
|
| 198 |
|
| 199 |
raw_depth = gr.State() # 🔑 保存模型输出
|
| 200 |
|
| 201 |
+
with gr.Row():
|
| 202 |
+
|
| 203 |
+
# ========== Left ==========
|
| 204 |
+
# 左侧列(Input Image)
|
| 205 |
+
with gr.Column(scale=10):
|
| 206 |
+
inp = gr.Image(
|
| 207 |
+
type="numpy",
|
| 208 |
+
label="Input Image",
|
| 209 |
+
height=360
|
| 210 |
+
)
|
| 211 |
+
|
| 212 |
+
gr.Markdown("### Examples (click to load)")
|
| 213 |
+
gr.Examples(examples=example_paths, inputs=inp)
|
| 214 |
+
|
| 215 |
+
gr.Markdown("### Examples from Gemini (click to load)")
|
| 216 |
+
gr.Examples(examples=example_gen_paths, inputs=inp)
|
| 217 |
+
|
| 218 |
+
btn_infer = gr.Button("Run Inference", variant="primary")
|
| 219 |
+
btn_100m = gr.Button("Visualize (100m)")
|
| 220 |
+
btn_10m = gr.Button("Visualize (10m)")
|
| 221 |
+
|
| 222 |
+
gr.Markdown(
|
| 223 |
+
"""
|
| 224 |
+
<small>
|
| 225 |
+
<b>Visualization range:</b><br>
|
| 226 |
+
• <b>100m</b>: recommended for <b>outdoor</b> scenes<br>
|
| 227 |
+
• <b>10m</b>: recommended for <b>indoor</b> scenes<br>
|
| 228 |
+
(Only affects visualization, not the raw depth output)
|
| 229 |
+
</small>
|
| 230 |
+
""",
|
| 231 |
+
elem_id="vis_hint",
|
| 232 |
+
)
|
| 233 |
+
|
| 234 |
+
# ========== Right ==========
|
| 235 |
+
# 右侧整体(包含 中间列 + colorbar 列)
|
| 236 |
+
with gr.Column(scale=11):
|
| 237 |
+
|
| 238 |
+
# -------- Row 1: Color Depth --------
|
| 239 |
+
with gr.Row():
|
| 240 |
+
# 中间列(必须和左侧等宽)
|
| 241 |
+
with gr.Column(scale=10):
|
| 242 |
+
out_color = gr.Image(
|
| 243 |
+
label="Depth (Color)",
|
| 244 |
+
height=260
|
| 245 |
+
)
|
| 246 |
+
|
| 247 |
+
# colorbar 列(很窄)
|
| 248 |
+
with gr.Column(scale=1, min_width=80):
|
| 249 |
+
colorbar_color = gr.Image(
|
| 250 |
+
label="Scale",
|
| 251 |
+
height=260,
|
| 252 |
+
show_label=False
|
| 253 |
+
)
|
| 254 |
+
|
| 255 |
+
# -------- Row 2: Gray Depth --------
|
| 256 |
+
with gr.Row():
|
| 257 |
+
with gr.Column(scale=10):
|
| 258 |
+
out_gray = gr.Image(
|
| 259 |
+
label="Depth (Gray)",
|
| 260 |
+
height=260
|
| 261 |
+
)
|
| 262 |
+
|
| 263 |
+
with gr.Column(scale=1, min_width=80):
|
| 264 |
+
colorbar_gray = gr.Image(
|
| 265 |
+
label="Scale",
|
| 266 |
+
height=260,
|
| 267 |
+
show_label=False
|
| 268 |
+
)
|
| 269 |
+
|
| 270 |
+
out_npy = gr.File(label="Depth (.npy)")
|
| 271 |
|
| 272 |
|
| 273 |
# 1️⃣ 跑模型
|