Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -13,19 +13,19 @@ 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 |
@spaces.GPU
|
| 16 |
-
def depth_anything_inference(
|
| 17 |
-
return depth_anything(
|
| 18 |
@spaces.GPU
|
| 19 |
-
def dpt_beit_inference(
|
| 20 |
-
return dpt_beit(
|
| 21 |
|
| 22 |
@spaces.GPU
|
| 23 |
-
def dpt_large_inference(
|
| 24 |
-
return dpt_large(
|
| 25 |
|
| 26 |
|
| 27 |
-
def infer(
|
| 28 |
-
return dpt_large_inference(
|
| 29 |
|
| 30 |
|
| 31 |
css = """
|
|
@@ -39,12 +39,19 @@ 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")
|
| 43 |
with gr.Row():
|
| 44 |
output_1 = gr.Image(type="pil", label="DPT-Large")
|
| 45 |
output_2 = gr.Image(type="pil", label="DPT with BeiT Backbone")
|
| 46 |
output_3 = gr.Image(type="pil", label="Depth Anything")
|
| 47 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
|
| 49 |
input_img.change(infer, [input_img], [output_1, output_2, output_3])
|
| 50 |
|
|
|
|
| 13 |
depth_anything = pipeline(task = "depth-estimation", model="nielsr/depth-anything-small")
|
| 14 |
dpt_large = pipeline(task = "depth-estimation", model="intel/dpt-large")
|
| 15 |
@spaces.GPU
|
| 16 |
+
def depth_anything_inference(img):
|
| 17 |
+
return depth_anything(img)["depth"]
|
| 18 |
@spaces.GPU
|
| 19 |
+
def dpt_beit_inference(img):
|
| 20 |
+
return dpt_beit(img)["depth"]
|
| 21 |
|
| 22 |
@spaces.GPU
|
| 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 |
|
| 30 |
|
| 31 |
css = """
|
|
|
|
| 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")
|
| 43 |
with gr.Row():
|
| 44 |
output_1 = gr.Image(type="pil", label="DPT-Large")
|
| 45 |
output_2 = gr.Image(type="pil", label="DPT with BeiT Backbone")
|
| 46 |
output_3 = gr.Image(type="pil", label="Depth Anything")
|
| 47 |
+
|
| 48 |
+
gr.Examples([["bee.jpg"]],
|
| 49 |
+
inputs = input_img,
|
| 50 |
+
outputs = [output_1, output_2, output_3],
|
| 51 |
+
fn=infer,
|
| 52 |
+
cache_examples=True,
|
| 53 |
+
label='Click on any Examples below to get depth estimation results quickly 👇'
|
| 54 |
+
)
|
| 55 |
|
| 56 |
input_img.change(infer, [input_img], [output_1, output_2, output_3])
|
| 57 |
|