File size: 697 Bytes
faf0b67
 
 
 
 
 
 
 
 
 
 
905f062
faf0b67
 
b6ef95c
28f61dd
faf0b67
 
 
 
28f61dd
 
9c7b1ec
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import os, io
import gradio as gr
from transformers import pipeline
# from PIL import Image

# API_URL = "https://api-inference.huggingface.co/models/facebook/detr-resnet-50-panoptic"

SECRET_TOKEN = os.getenv("SECRET_TOKEN")
API_URL = "https://api-inference.huggingface.co/models/facebook/detr-resnet-50-dc5-panoptic"
headers = {"Authorization": f'Bearer {SECRET_TOKEN}'}

estimator = pipeline("depth-estimation")

def rb(img):
    result = estimator(img)
    return result["depth"]


inputs = gr.inputs.Image(type="pil", label="Upload an image")


demo = gr.Interface(fn=rb, inputs=inputs, outputs=rb(inputs))
# #demo = gr.Interface(fn=rb, inputs=inputs, outputs=result["depth"])
# demo.launch()