File size: 1,277 Bytes
f9b47bb
7251698
 
 
9ae20c2
 
 
7251698
 
f9b47bb
 
2301d47
 
 
 
 
 
 
3ef559c
 
 
 
 
 
 
 
7251698
 
 
 
 
2f2bb5a
7251698
7b818ea
 
 
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
34
35
36
import gradio as gr
import numpy as np

def inference(image):
    img1 = np.array(np.random.rand(240,240))
    img2 = np.array(np.random.rand(240,240))
    img3 = np.array(np.random.rand(240,240))
    parts_list_damage = 'test'
    return img1, img2, img3, parts_list_damage

with gr.Blocks() as demo:
    with gr.Row():
        with gr.Column():
            gr.Markdown("## Inputs")
            image = gr.Image(type="pil",label="Input")
            submit_button = gr.Button(value="Submit", label="Submit")
        with gr.Column():
            gr.Markdown("## Outputs")
            with gr.Tab('Image of damages'):
                im1 = gr.Image(type='numpy',label='Image of damages')
            with gr.Tab('Image of scratches'):
                im2 = gr.Image(type='numpy',label='Image of scratches')
            with gr.Tab('Image of parts'):
                im3 = gr.Image(type='numpy',label='Image of car parts')
            with gr.Tab('Information about damaged parts'):
                intersections = gr.Textbox(label='Information about type of damages on each part')
    
    #actions
    submit_button.click(
        fn=inference,
        inputs = [image],
        outputs = [im1,im2,im3,intersections]
    )
        
if __name__ == "__main__":
    demo.launch()