anveshg03 commited on
Commit
6ab39e6
·
verified ·
1 Parent(s): 0ec5d33

gr.interface() for predict_depth_normal

Browse files
Files changed (1) hide show
  1. app.py +24 -2
app.py CHANGED
@@ -335,7 +335,7 @@ with gr.Blocks(title=title, css=custom_css) as demo:
335
  submit_button.click(fn=predict_depth_normal, inputs=[image_input, model_dropdown, fx, fy, state_cache], outputs=[depth_output, depth_file, normal_output, normal_file, state_cache, message_box])
336
  reconstruct_button.click(fn=unprojection_pcd, inputs=[state_cache], outputs=[pcd_output, pcd_ply, message_box])
337
 
338
- demo.launch()
339
 
340
 
341
  # iface = gr.Interface(
@@ -356,4 +356,26 @@ demo.launch()
356
  # analytics_enabled=False
357
  # )
358
 
359
- # iface.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
335
  submit_button.click(fn=predict_depth_normal, inputs=[image_input, model_dropdown, fx, fy, state_cache], outputs=[depth_output, depth_file, normal_output, normal_file, state_cache, message_box])
336
  reconstruct_button.click(fn=unprojection_pcd, inputs=[state_cache], outputs=[pcd_output, pcd_ply, message_box])
337
 
338
+ demo.launch(server_name="0.0.0.0")
339
 
340
 
341
  # iface = gr.Interface(
 
356
  # analytics_enabled=False
357
  # )
358
 
359
+ # iface.launch()
360
+
361
+
362
+ iface = gr.Interface(
363
+ fn=predict_depth_normal,
364
+ inputs=[
365
+ gr.Image(type='pil', label="Original Image"),
366
+ gr.Dropdown(["vit-small", "vit-large"], label="Model"),
367
+ gr.Number(1000.0, label="fx in pixels"),
368
+ gr.Number(1000.0, label="fy in pixels")
369
+ ],
370
+ outputs=[
371
+ gr.Image(label="Output Depth"),
372
+ gr.File(label="Depth (.npy)"),
373
+ gr.Image(label="Output Normal"),
374
+ gr.File(label="Normal (.npy)"),
375
+ gr.Textbox(label="Messages")
376
+ ],
377
+ title="Metric3D",
378
+ description="Metric3Dv2: A versatile monocular geometric foundation model for zero-shot metric depth and surface normal estimation."
379
+ )
380
+
381
+ iface.launch()