Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -54,13 +54,13 @@ filepath = hf_hub_download(repo_id="depth-anything/Depth-Anything-V2-Metric-Indo
|
|
| 54 |
#model.load_state_dict(state_dict)
|
| 55 |
#model = model.to(DEVICE).eval()
|
| 56 |
|
| 57 |
-
pipe = pipeline(task="depth-estimation", model="depth-anything/Depth-Anything-V2-Metric-Indoor-Large-hf", device=
|
| 58 |
|
| 59 |
title = "# Depth Anything V2"
|
| 60 |
description = """Official demo for **Depth Anything V2**.
|
| 61 |
Please refer to our [paper](https://arxiv.org/abs/2406.09414), [project page](https://depth-anything-v2.github.io), and [github](https://github.com/DepthAnything/Depth-Anything-V2) for more details."""
|
| 62 |
|
| 63 |
-
@
|
| 64 |
def predict_depth(image):
|
| 65 |
return pipe(Image.fromarray(image))["depth"]
|
| 66 |
|
|
@@ -71,7 +71,7 @@ with gr.Blocks(css="") as demo:
|
|
| 71 |
|
| 72 |
with gr.Row():
|
| 73 |
input_image = gr.Image(label="Input Image", type='numpy', elem_id='img-display-input')
|
| 74 |
-
depth_image_slider = gr.Image(label="Depth Map with Slider View", elem_id='img-display-output'
|
| 75 |
submit = gr.Button(value="Compute Depth")
|
| 76 |
gray_depth_file = gr.File(label="Grayscale depth map", elem_id="download")
|
| 77 |
raw_file = gr.File(label="16-bit raw output (can be considered as disparity)", elem_id="download")
|
|
|
|
| 54 |
#model.load_state_dict(state_dict)
|
| 55 |
#model = model.to(DEVICE).eval()
|
| 56 |
|
| 57 |
+
pipe = pipeline(task="depth-estimation", model="depth-anything/Depth-Anything-V2-Metric-Indoor-Large-hf", device=0) # Use appropriate device
|
| 58 |
|
| 59 |
title = "# Depth Anything V2"
|
| 60 |
description = """Official demo for **Depth Anything V2**.
|
| 61 |
Please refer to our [paper](https://arxiv.org/abs/2406.09414), [project page](https://depth-anything-v2.github.io), and [github](https://github.com/DepthAnything/Depth-Anything-V2) for more details."""
|
| 62 |
|
| 63 |
+
@gr.Interface
|
| 64 |
def predict_depth(image):
|
| 65 |
return pipe(Image.fromarray(image))["depth"]
|
| 66 |
|
|
|
|
| 71 |
|
| 72 |
with gr.Row():
|
| 73 |
input_image = gr.Image(label="Input Image", type='numpy', elem_id='img-display-input')
|
| 74 |
+
depth_image_slider = gr.Image(label="Depth Map with Slider View", elem_id='img-display-output')
|
| 75 |
submit = gr.Button(value="Compute Depth")
|
| 76 |
gray_depth_file = gr.File(label="Grayscale depth map", elem_id="download")
|
| 77 |
raw_file = gr.File(label="16-bit raw output (can be considered as disparity)", elem_id="download")
|