Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,20 @@
|
|
1 |
import gradio as gr
|
2 |
|
3 |
def greet(name):
|
4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
7 |
iface.launch()
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
def greet(name):
|
4 |
+
from transformers import pipeline
|
5 |
+
from PIL import Image
|
6 |
+
import requests
|
7 |
+
|
8 |
+
# load pipe
|
9 |
+
pipe = pipeline(task="depth-estimation", model="LiheYoung/depth-anything-small-hf")
|
10 |
+
|
11 |
+
# load image
|
12 |
+
url = 'http://images.cocodataset.org/val2017/000000039769.jpg'
|
13 |
+
image = Image.open(requests.get(url, stream=True).raw)
|
14 |
+
|
15 |
+
# inference
|
16 |
+
depth = pipe(image)["depth"]
|
17 |
+
return "depth: " + depth
|
18 |
|
19 |
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
20 |
iface.launch()
|