|
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') |
|
|
|
|
|
submit_button.click( |
|
fn=inference, |
|
inputs = [image], |
|
outputs = [im1,im2,im3,intersections] |
|
) |
|
|
|
if __name__ == "__main__": |
|
demo.launch() |