Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,21 +9,21 @@ import os
|
|
| 9 |
import spaces
|
| 10 |
import json
|
| 11 |
|
| 12 |
-
dpt_beit = pipeline(task = "depth-estimation", model="Intel/dpt-beit-base-384")
|
| 13 |
-
depth_anything = pipeline(task = "depth-estimation", model="nielsr/depth-anything-small")
|
| 14 |
-
dpt_large = pipeline(task = "depth-estimation", model="intel/dpt-large")
|
| 15 |
-
|
| 16 |
def depth_anything_inference(img):
|
| 17 |
return depth_anything(img)["depth"]
|
| 18 |
-
|
| 19 |
def dpt_beit_inference(img):
|
| 20 |
return dpt_beit(img)["depth"]
|
| 21 |
|
| 22 |
-
|
| 23 |
def dpt_large_inference(img):
|
| 24 |
return dpt_large(img)["depth"]
|
| 25 |
|
| 26 |
-
|
| 27 |
def infer(img):
|
| 28 |
return dpt_large_inference(img), dpt_beit_inference(img), depth_anything_inference(img)
|
| 29 |
|
|
@@ -37,6 +37,9 @@ css = """
|
|
| 37 |
"""
|
| 38 |
with gr.Blocks(css=css) as demo:
|
| 39 |
gr.HTML("<h1><center>Compare Depth Estimation Models<center><h1>")
|
|
|
|
|
|
|
|
|
|
| 40 |
with gr.Column():
|
| 41 |
with gr.Row():
|
| 42 |
input_img = gr.Image(label="Input Image", type="pil")
|
|
|
|
| 9 |
import spaces
|
| 10 |
import json
|
| 11 |
|
| 12 |
+
dpt_beit = pipeline(task = "depth-estimation", model="Intel/dpt-beit-base-384", device=0)
|
| 13 |
+
depth_anything = pipeline(task = "depth-estimation", model="nielsr/depth-anything-small", device=0)
|
| 14 |
+
dpt_large = pipeline(task = "depth-estimation", model="intel/dpt-large", device=0)
|
| 15 |
+
|
| 16 |
def depth_anything_inference(img):
|
| 17 |
return depth_anything(img)["depth"]
|
| 18 |
+
|
| 19 |
def dpt_beit_inference(img):
|
| 20 |
return dpt_beit(img)["depth"]
|
| 21 |
|
| 22 |
+
|
| 23 |
def dpt_large_inference(img):
|
| 24 |
return dpt_large(img)["depth"]
|
| 25 |
|
| 26 |
+
@spaces.GPU
|
| 27 |
def infer(img):
|
| 28 |
return dpt_large_inference(img), dpt_beit_inference(img), depth_anything_inference(img)
|
| 29 |
|
|
|
|
| 37 |
"""
|
| 38 |
with gr.Blocks(css=css) as demo:
|
| 39 |
gr.HTML("<h1><center>Compare Depth Estimation Models<center><h1>")
|
| 40 |
+
gr.HTML("<h2><center>In this Space, you can compare different depth estimation models: [DPT-Large](https://huggingface.co/Intel/dpt-large), [DPT with BeiT backbone](https://huggingface.co/Intel/dpt-beit-large-512) and the recent [Depth Anything Model's small checkpoint](https://huggingface.co/LiheYoung/depth-anything-small-hf).<center><h2>")
|
| 41 |
+
gr.HTML("<h1><center>Simply upload an image or try the example to see the outputs.<center><h1>")
|
| 42 |
+
|
| 43 |
with gr.Column():
|
| 44 |
with gr.Row():
|
| 45 |
input_img = gr.Image(label="Input Image", type="pil")
|