File size: 468 Bytes
3fce28b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d16f22f
3fce28b
 
 
 
 
d16f22f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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")


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"),

]).launch(share=True)