Akash Raj commited on
Commit
6f72020
1 Parent(s): 1d0844e
Files changed (1) hide show
  1. app.py +14 -7
app.py CHANGED
@@ -1,22 +1,29 @@
 
 
1
  import gradio as gr
2
 
3
- def duplicate_image(image):
4
- # Simply return the same image twice
5
- return image, image
 
 
 
 
6
 
7
  # Create a Gradio interface
8
  iface = gr.Interface(
9
- fn=duplicate_image,
10
  inputs=gr.Image(type="pil"),
11
- outputs=[gr.Image(type="pil"), gr.Image(type="pil")],
12
- title="Duplicate Image",
13
- description="Upload an image and get two identical copies as output."
14
  )
15
 
16
  # Launch the Gradio app
17
  iface.launch()
18
 
19
 
 
20
  """
21
  from transformers import pipeline
22
  from PIL import Image
 
1
+ from transformers import pipeline
2
+ from PIL import Image
3
  import gradio as gr
4
 
5
+ # Load the Hugging Face depth estimation pipeline
6
+ pipe = pipeline(task="depth-estimation", model="LiheYoung/depth-anything-small-hf")
7
+
8
+ def estimate_depth(image):
9
+ # Perform depth estimation on the input image
10
+ depth = pipe(image)["depth"]
11
+ return depth
12
 
13
  # Create a Gradio interface
14
  iface = gr.Interface(
15
+ fn=estimate_depth,
16
  inputs=gr.Image(type="pil"),
17
+ outputs=gr.Image(type="pil"),
18
+ title="Depth Estimation",
19
+ description="Upload an image to get its depth estimation map."
20
  )
21
 
22
  # Launch the Gradio app
23
  iface.launch()
24
 
25
 
26
+
27
  """
28
  from transformers import pipeline
29
  from PIL import Image