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=estimator, inputs=inputs, outputs=gr.Label()) #demo = gr.Interface(fn=rb, inputs=inputs, outputs=result["depth"]) demo.launch()