Spaces:
Running
Running
Akash Raj
commited on
Commit
•
6f72020
1
Parent(s):
1d0844e
test
Browse files
app.py
CHANGED
@@ -1,22 +1,29 @@
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
-
|
4 |
-
|
5 |
-
|
|
|
|
|
|
|
|
|
6 |
|
7 |
# Create a Gradio interface
|
8 |
iface = gr.Interface(
|
9 |
-
fn=
|
10 |
inputs=gr.Image(type="pil"),
|
11 |
-
outputs=
|
12 |
-
title="
|
13 |
-
description="Upload an image
|
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
|