merve HF staff commited on
Commit
4d5842c
1 Parent(s): 1730824

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -9
app.py CHANGED
@@ -11,6 +11,8 @@ import spaces
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
  @spaces.GPU
15
  def depth_anything_inference(image_path):
16
  return depth_anything(image_path)["depth"]
@@ -19,17 +21,13 @@ def depth_anything_inference(image_path):
19
  def dpt_beit_inference(image):
20
  return dpt_beit(image)["depth"]
21
 
22
- def dpt_large(image_path):
23
- try:
24
- client = Client("https://nielsr-dpt-depth-estimation.hf.space/")
25
- return Image.open(client.predict(image_path))
26
- except Exception:
27
- gr.Warning("The DPT-Large Space is currently unavailable. Please try again later.")
28
- return ""
29
 
30
 
31
  def infer(image):
32
- return dpt_large(image), dpt_beit_inference(image), depth_anything_inference(image)
33
 
34
 
35
  iface = gr.Interface(fn=infer,
@@ -40,5 +38,5 @@ iface = gr.Interface(fn=infer,
40
 
41
  title="Compare Depth Estimation Models",
42
  description="In this Space you can compare various depth estimation models.",
43
- examples=[["./bee.JPG"]])
44
  iface.launch(debug=True)
 
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
  @spaces.GPU
17
  def depth_anything_inference(image_path):
18
  return depth_anything(image_path)["depth"]
 
21
  def dpt_beit_inference(image):
22
  return dpt_beit(image)["depth"]
23
 
24
+
25
+ def dpt_large_inference(image):
26
+ return dpt_large(image)["depth"]
 
 
 
 
27
 
28
 
29
  def infer(image):
30
+ return dpt_large_inference(image), dpt_beit_inference(image), depth_anything_inference(image)
31
 
32
 
33
  iface = gr.Interface(fn=infer,
 
38
 
39
  title="Compare Depth Estimation Models",
40
  description="In this Space you can compare various depth estimation models.",
41
+ examples=[["bee.JPG"]])
42
  iface.launch(debug=True)