yuragoithf's picture
Update app.py
5254378
raw
history blame
684 Bytes
import os, io
import gradio as gr
from transformers import pipeline
SECRET_TOKEN = os.getenv("SECRET_TOKEN")
headers = {"Authorization": f'Bearer {SECRET_TOKEN}'}
estimator = pipeline("depth-estimation")
def rb(img):
result = estimator(img)
return result["depth"]
description = """Upload an image and get the depth visualization"""
title = """Depth Estimation"""
examples=[["house.jpg"], ["plane.webp"], ["room.webp"]]
inputs = gr.inputs.Image(type="pil", label="Upload an image")
outputs = gr.outputs.Image(type="pil",label="Output Image")
demo = gr.Interface(fn=rb, inputs=inputs, outputs=outputs, examples=examples, title=title, description=description)
demo.launch()