File size: 2,175 Bytes
0ec350f d4efcb1 0ec350f 6ecf21a d4efcb1 0ec350f d4efcb1 0ec350f d4efcb1 e280219 d4efcb1 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | ---
title: DepthPro2
emoji: 📷
colorFrom: blue
colorTo: pink
sdk: gradio
sdk_version: 6.32.0
python_version: "3.12"
app_file: app.py
pinned: false
license: other
license_name: apple-amlr
short_description: Metric monocular depth from photos and videos
startup_duration_timeout: 1h
---
# Depth Pro 2 — metric monocular depth demo
Gradio demo for [apple/DepthPro2](https://huggingface.co/apple/DepthPro2)
([code](https://github.com/apple-aiml-research/ml-depth-pro-2)): metric depth for every pixel
from a single photo or a whole video, sharp at object edges and steady from frame to frame.
Uses the **DepthPro2-H** weights (872M parameters) with the focal length taken from the photo's
EXIF when present.
The app follows the model card's quick start: weights created with
`create_model_and_transforms(..., precision=torch.bfloat16)`, `model.infer(...)` for images and
`model.infer_video(...)` over frames decoded with PyAV. The focal length comes from the photo's
EXIF when present, otherwise the bundled focal estimator estimates it. The app is written for
ZeroGPU (`@spaces.GPU`-decorated functions, weights moved to CUDA inside the call); on plain CPU
hardware it still runs, just slowly.
<div style="display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin:0 0 2em"><a href="https://hf.co/chat?mode=ml-intern"><img src="https://hf.co/datasets/huggingface/badges/resolve/main/built-with-ml-intern-lg.svg" alt="Built with ML Intern" style="margin:0"></a><a href="https://hf.co/chat?mode=ml-intern&prompt=Add%20a%20live-camera%20tab%20to%20akhaliq%2FDepthPro2" style="display:inline-flex;align-items:center;gap:5px;padding:4px 12px;border:1.5px solid #eee;border-radius:16px;background:#f9fbfc;color:#c2410c;font-weight:600;font-size:14px;text-decoration:none">Add a live-camera tab ›</a><a href="https://hf.co/chat?mode=ml-intern&prompt=Switch%20akhaliq%2FDepthPro2%20to%20DepthPro2-L%20weights%20for%20faster%20inference" style="display:inline-flex;align-items:center;gap:5px;padding:4px 12px;border:1.5px solid #eee;border-radius:16px;background:#f9fbfc;color:#c2410c;font-weight:600;font-size:14px;text-decoration:none">Swap in the L weights ›</a></div>
|