Insta360-Research commited on
Commit
cc5db9a
·
verified ·
1 Parent(s): 16819da

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +70 -35
app.py CHANGED
@@ -199,41 +199,76 @@ with gr.Blocks() as demo:
199
  raw_depth = gr.State() # 🔑 保存模型输出
200
 
201
  with gr.Row():
202
- # ========== Left ==========
203
- with gr.Column(scale=1):
204
- inp = gr.Image(type="numpy", label="Input Image", height=360)
205
-
206
- gr.Markdown("### Examples (click to load)")
207
- gr.Examples(examples=example_paths, inputs=inp)
208
-
209
- gr.Markdown("### Examples from Gemini (click to load)")
210
- gr.Examples(examples=example_gen_paths, inputs=inp)
211
-
212
- btn_infer = gr.Button("Run Inference", variant="primary")
213
- btn_100m = gr.Button("Visualize (100m)")
214
- btn_10m = gr.Button("Visualize (10m)")
215
-
216
- gr.Markdown(
217
- """
218
- <small>
219
- <b>Visualization range:</b><br>
220
- <b>100m</b>: recommended for <b>outdoor</b> scenes<br>
221
- • <b>10m</b>: recommended for <b>indoor</b> scenes<br>
222
- (Only affects visualization, not the raw depth output)
223
- </small>
224
- """,
225
- elem_id="vis_hint",
226
- )
227
-
228
- # ========== Right ==========
229
- with gr.Column(scale=2):
230
- with gr.Row():
231
- out_color = gr.Image(label="Depth (Color)", height=260, scale=20)
232
- colorbar_color = gr.Image(label="Scale", height=260, scale=1, show_label=False, min_width=100)
233
- with gr.Row():
234
- out_gray = gr.Image(label="Depth (Gray)", height=260, scale=20)
235
- colorbar_gray = gr.Image(label="Scale", height=260, scale=1, show_label=False, min_width=100)
236
- out_npy = gr.File(label="Depth (.npy)")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
237
 
238
  # 1️⃣ 跑模型
239
  btn_infer.click(
 
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️⃣ 跑模型
274
  btn_infer.click(