Spaces:
Runtime error
Runtime error
RamAnanth1
commited on
Commit
•
5075641
1
Parent(s):
163beec
Add example
Browse files
app.py
CHANGED
@@ -6,7 +6,7 @@ import matplotlib.pyplot as plt
|
|
6 |
|
7 |
title = "Interactive demo: ZoeDepth"
|
8 |
description = "Unofficial Gradio Demo for using ZoeDepth: Zero-shot Transfer by Combining Relative and Metric Depth. To use it, simply upload an image or use one of the examples below and click 'Submit'. Results will show up in a few seconds."
|
9 |
-
|
10 |
repo = "isl-org/ZoeDepth"
|
11 |
# Zoe_N
|
12 |
model_zoe_n = torch.hub.load(repo, "ZoeD_N", pretrained=True)
|
@@ -14,11 +14,8 @@ DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
|
|
14 |
zoe = model_zoe_n.to(DEVICE)
|
15 |
|
16 |
def process_image(image):
|
17 |
-
|
18 |
depth = zoe.infer_pil(image) # as numpy
|
19 |
colored_depth = colorize(depth)
|
20 |
-
colored_depth = colored_depth.resize((512,512))
|
21 |
-
|
22 |
return colored_depth
|
23 |
|
24 |
interface = gr.Interface(fn=process_image,
|
@@ -27,6 +24,7 @@ interface = gr.Interface(fn=process_image,
|
|
27 |
],
|
28 |
title=title,
|
29 |
description=description,
|
|
|
30 |
)
|
31 |
|
32 |
interface.launch(debug=True)
|
|
|
6 |
|
7 |
title = "Interactive demo: ZoeDepth"
|
8 |
description = "Unofficial Gradio Demo for using ZoeDepth: Zero-shot Transfer by Combining Relative and Metric Depth. To use it, simply upload an image or use one of the examples below and click 'Submit'. Results will show up in a few seconds."
|
9 |
+
examples = [["example.png"]]
|
10 |
repo = "isl-org/ZoeDepth"
|
11 |
# Zoe_N
|
12 |
model_zoe_n = torch.hub.load(repo, "ZoeD_N", pretrained=True)
|
|
|
14 |
zoe = model_zoe_n.to(DEVICE)
|
15 |
|
16 |
def process_image(image):
|
|
|
17 |
depth = zoe.infer_pil(image) # as numpy
|
18 |
colored_depth = colorize(depth)
|
|
|
|
|
19 |
return colored_depth
|
20 |
|
21 |
interface = gr.Interface(fn=process_image,
|
|
|
24 |
],
|
25 |
title=title,
|
26 |
description=description,
|
27 |
+
examples = examples
|
28 |
)
|
29 |
|
30 |
interface.launch(debug=True)
|