File size: 1,181 Bytes
64fb58a
 
 
 
 
 
 
 
 
 
 
 
 
 
582115f
64fb58a
 
 
 
582115f
 
 
64fb58a
582115f
 
 
64fb58a
 
 
 
 
35156d3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import gradio as gr
from PIL import Image
import tempfile


def predict_depth(model, image):
    depth = model.infer_pil(image)
    return depth


def create_demo():
    with gr.Row():
        with gr.Column(scale=1):
            model_type = gr.Dropdown(["Prismer-Base", "Prismer-Large"], label="Model Size", value="Prismer-Base")
            rgb = gr.Image(label="Input Image", type='pil')
            submit = gr.Button("Submit")
        with gr.Column(scale=2):
            pred = gr.Textbox(label="Model Prediction")
            with gr.Row():
                depth = gr.Image(label="Depth")
                edge = gr.Image(label="Edge")
                normals = gr.Image(label="Normals")
            with gr.Row():
                seg = gr.Image(label="Segmentation")
                obj_det = gr.Image(label="Object Detection")
                ocr_det = gr.Image(label="OCR Detection")

    def on_submit(im, model_type):
        return pred, depth, edge, normals, seg, obj_det, ocr_det

    submit.click(on_submit, inputs=[rgb, model_type], outputs=[pred, depth, edge, normals, seg, obj_det, ocr_det])
    examples = gr.Examples(examples=["examples/1.png"], inputs=[rgb])