ameerazam08 commited on
Commit
4802bf7
1 Parent(s): 0d10948

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +40 -4
app.py CHANGED
@@ -1,7 +1,43 @@
1
  import gradio as gr
 
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
 
5
 
6
- iface = gr.Interface(fn=greet, inputs="text", outputs="text")
7
- iface.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
+ import torch
3
 
4
+ from gradio_depth_pred import create_demo as create_depth_pred_demo
5
+ from gradio_im_to_3d import create_demo as create_im_to_3d_demo
6
+ from gradio_pano_to_3d import create_demo as create_pano_to_3d_demo
7
 
8
+
9
+ css = """
10
+ #img-display-container {
11
+ max-height: 50vh;
12
+ }
13
+ #img-display-input {
14
+ max-height: 40vh;
15
+ }
16
+ #img-display-output {
17
+ max-height: 40vh;
18
+ }
19
+
20
+ """
21
+ DEVICE = 'cuda' if torch.cuda.is_available() else 'cpu'
22
+ model = torch.hub.load('isl-org/ZoeDepth', "ZoeD_N", pretrained=True).to(DEVICE).eval()
23
+
24
+ title = "# ZoeDepth"
25
+ description = """Official demo for **ZoeDepth: Zero-shot Transfer by Combining Relative and Metric Depth**.
26
+ ZoeDepth is a deep learning model for metric depth estimation from a single image.
27
+ Please refer to our [paper](https://arxiv.org/abs/2302.12288) or [github](https://github.com/isl-org/ZoeDepth) for more details."""
28
+
29
+ with gr.Blocks(css=css) as demo:
30
+ gr.Markdown(title)
31
+ gr.Markdown(description)
32
+ with gr.Tab("Depth Prediction"):
33
+ create_depth_pred_demo(model)
34
+ with gr.Tab("Image to 3D"):
35
+ create_im_to_3d_demo(model)
36
+ with gr.Tab("360 Panorama to 3D"):
37
+ create_pano_to_3d_demo(model)
38
+
39
+ gr.HTML('''<br><br><br><center>You can duplicate this Space to skip the queue:<a href="https://huggingface.co/spaces/shariqfarooq/ZoeDepth?duplicate=true"><img src="https://bit.ly/3gLdBN6" alt="Duplicate Space"></a><br>
40
+ <p><img src="https://visitor-badge.glitch.me/badge?page_id=shariqfarooq.zoedepth_demo_hf" alt="visitors"></p></center>''')
41
+
42
+ if __name__ == '__main__':
43
+ demo.queue().launch()