multimodalart HF Staff commited on
Commit
3103e60
Β·
verified Β·
1 Parent(s): 3c00c1c

Upload app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +7 -6
app.py CHANGED
@@ -181,7 +181,7 @@ def predict_depth(image, max_side=MAX_IMAGE_SIDE, save_npz=False, save_png16=Fal
181
  f"depth 5–95th pct **{lo:.2f}–{hi:.2f} m** (median {mid:.2f} m) Β· "
182
  f"{result['elapsed']:.1f} s on GPU"
183
  )
184
- return colorize(inv, scale), caption, files or None
185
 
186
 
187
  def _video_duration(video, *args, **kwargs):
@@ -303,7 +303,7 @@ CSS = """
303
  .dark .gradio-container { color: var(--body-text-color); }
304
  """
305
 
306
- with gr.Blocks(theme=gr.themes.Citrus(), css=CSS, title="Depth Pro 2 L β€” metric depth") as demo:
307
  gr.Markdown(
308
  """
309
  # Depth Pro 2 L β€” metric monocular depth
@@ -328,6 +328,7 @@ with gr.Blocks(theme=gr.themes.Citrus(), css=CSS, title="Depth Pro 2 L β€” metri
328
  with gr.Column():
329
  depth_out = gr.Image(type="numpy", label="Depth (meters, Turbo)", format="png")
330
  photo_caption = gr.Markdown()
 
331
  with gr.Accordion("Advanced options", open=False):
332
  with gr.Row():
333
  with gr.Column():
@@ -354,7 +355,7 @@ with gr.Blocks(theme=gr.themes.Citrus(), css=CSS, title="Depth Pro 2 L β€” metri
354
  examples=[["assets/example.jpg"]],
355
  inputs=[image_in],
356
  fn=predict_depth,
357
- outputs=[depth_out, photo_caption],
358
  cache_examples=True,
359
  cache_mode="lazy",
360
  label="Apple's example photo (no EXIF focal β€” exercises the focal estimator)",
@@ -389,8 +390,8 @@ with gr.Blocks(theme=gr.themes.Citrus(), css=CSS, title="Depth Pro 2 L β€” metri
389
 
390
  photo_btn.click(
391
  fn=predict_depth,
392
- inputs=[image_in, max_side, save_png16, save_npz_img],
393
- outputs=[depth_out, photo_caption],
394
  api_name="predict_depth",
395
  )
396
  video_btn.click(
@@ -400,4 +401,4 @@ with gr.Blocks(theme=gr.themes.Citrus(), css=CSS, title="Depth Pro 2 L β€” metri
400
  api_name="predict_depth_video",
401
  )
402
 
403
- demo.launch(mcp_server=True)
 
181
  f"depth 5–95th pct **{lo:.2f}–{hi:.2f} m** (median {mid:.2f} m) Β· "
182
  f"{result['elapsed']:.1f} s on GPU"
183
  )
184
+ return colorize(inv, scale), caption, files
185
 
186
 
187
  def _video_duration(video, *args, **kwargs):
 
303
  .dark .gradio-container { color: var(--body-text-color); }
304
  """
305
 
306
+ with gr.Blocks(title="Depth Pro 2 L β€” metric depth") as demo:
307
  gr.Markdown(
308
  """
309
  # Depth Pro 2 L β€” metric monocular depth
 
328
  with gr.Column():
329
  depth_out = gr.Image(type="numpy", label="Depth (meters, Turbo)", format="png")
330
  photo_caption = gr.Markdown()
331
+ files_out = gr.Files(label="Downloads")
332
  with gr.Accordion("Advanced options", open=False):
333
  with gr.Row():
334
  with gr.Column():
 
355
  examples=[["assets/example.jpg"]],
356
  inputs=[image_in],
357
  fn=predict_depth,
358
+ outputs=[depth_out, photo_caption, files_out],
359
  cache_examples=True,
360
  cache_mode="lazy",
361
  label="Apple's example photo (no EXIF focal β€” exercises the focal estimator)",
 
390
 
391
  photo_btn.click(
392
  fn=predict_depth,
393
+ inputs=[image_in, max_side, save_npz_img, save_png16],
394
+ outputs=[depth_out, photo_caption, files_out],
395
  api_name="predict_depth",
396
  )
397
  video_btn.click(
 
401
  api_name="predict_depth_video",
402
  )
403
 
404
+ demo.launch(theme=gr.themes.Citrus(), css=CSS, mcp_server=True)