depthapi / app.py
nev's picture
Ininitial commit
3fce28b
raw
history blame
503 Bytes
from depth import MidasDepth
import gradio as gr
import numpy as np
import cv2
depth_estimator = MidasDepth()
def get_depth(rgb):
depth = depth_estimator.get_depth(rgb)
return rgb, (depth.clip(0, 64) * 1024).astype("uint16")
starter = gr.Interface(fn=get_depth, inputs=[
gr.components.Image(label="rgb", type="pil"),
], outputs=[
gr.components.Image(type="pil", label="image"),
gr.components.Image(type="numpy", label="depth"),
])
gr.Interface(get_depth).launch(share=True)