Spaces:
Sleeping
Sleeping
Commit
·
f708095
1
Parent(s):
88495eb
Update app.py
Browse files
app.py
CHANGED
@@ -1,12 +1,9 @@
|
|
1 |
import os, io
|
2 |
import gradio as gr
|
3 |
from transformers import pipeline
|
4 |
-
# from PIL import Image
|
5 |
|
6 |
-
# API_URL = "https://api-inference.huggingface.co/models/facebook/detr-resnet-50-panoptic"
|
7 |
|
8 |
SECRET_TOKEN = os.getenv("SECRET_TOKEN")
|
9 |
-
API_URL = "https://api-inference.huggingface.co/models/facebook/detr-resnet-50-dc5-panoptic"
|
10 |
headers = {"Authorization": f'Bearer {SECRET_TOKEN}'}
|
11 |
|
12 |
estimator = pipeline("depth-estimation")
|
@@ -15,10 +12,10 @@ def rb(img):
|
|
15 |
result = estimator(img)
|
16 |
return result["depth"]
|
17 |
|
18 |
-
|
|
|
19 |
inputs = gr.inputs.Image(type="pil", label="Upload an image")
|
20 |
outputs = gr.outputs.Image(type="pil",label="Output Image")
|
21 |
|
22 |
-
demo = gr.Interface(fn=rb, inputs=inputs, outputs=outputs)
|
23 |
-
# #demo = gr.Interface(fn=rb, inputs=inputs, outputs=result["depth"])
|
24 |
demo.launch()
|
|
|
1 |
import os, io
|
2 |
import gradio as gr
|
3 |
from transformers import pipeline
|
|
|
4 |
|
|
|
5 |
|
6 |
SECRET_TOKEN = os.getenv("SECRET_TOKEN")
|
|
|
7 |
headers = {"Authorization": f'Bearer {SECRET_TOKEN}'}
|
8 |
|
9 |
estimator = pipeline("depth-estimation")
|
|
|
12 |
result = estimator(img)
|
13 |
return result["depth"]
|
14 |
|
15 |
+
description = """Upload an image and get the detected classes"""
|
16 |
+
title = """Object Detection"""
|
17 |
inputs = gr.inputs.Image(type="pil", label="Upload an image")
|
18 |
outputs = gr.outputs.Image(type="pil",label="Output Image")
|
19 |
|
20 |
+
demo = gr.Interface(fn=rb, inputs=inputs, outputs=outputs, title=title, description=description)
|
|
|
21 |
demo.launch()
|