import gradio as gr | |
import PIL.Image | |
from transformers import pipeline | |
pipe = pipeline('depth-estimation', model='Intel/dpt-large') | |
def run(image: PIL.Image.Image) -> PIL.Image.Image: | |
return pipe(image)['depth'] | |
demo = gr.Interface(fn=run, | |
inputs=gr.Image(type='pil'), | |
outputs='image', | |
title='Depth Estimation', | |
examples=['cats.jpg', 'dogs.jpg']) | |
demo.queue().launch() | |