File size: 1,873 Bytes
3296110
dcc9cda
3296110
a6e2c31
3296110
dcc9cda
 
a6e2c31
3296110
dcc9cda
 
 
 
 
 
 
 
 
 
3296110
 
 
dcc9cda
 
 
 
 
 
 
 
 
 
3296110
 
 
a6e2c31
 
 
 
 
 
 
 
 
59632e2
a6e2c31
 
 
3296110
a6e2c31
 
 
 
 
 
3296110
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import gradio as gr
from utils import Predictor, setup

CAR_PART_SEG_OUT, CAR_DAM_DET_OUT, CAR_SEV_DET_OUT, SAMPLE = setup()

car_part_predictor = Predictor(CAR_PART_SEG_OUT)
car_dam_detector = Predictor(CAR_DAM_DET_OUT)
car_sev_detector = Predictor(CAR_SEV_DET_OUT)

car_part_ui = gr.Interface(
    fn=car_part_predictor.transform,
    inputs=[ 
        gr.components.Image(type="filepath", label="Input Image"),
        gr.components.Checkbox(value=True, label="Annotate Boxes"),
        gr.components.Checkbox(value=False, label="Annotate Masks"),
        ],
    outputs=gr.components.Image(type="numpy", label="Output Image"),
    title="Car Parts Detector",
    examples=SAMPLE["car-parts-seg"],
    cache_examples=False,
)

car_dam_ui = gr.Interface(
    fn=car_dam_detector.transform,
    inputs=[ 
        gr.components.Image(type="filepath", label="Input Image"),
        gr.components.Checkbox(value=True, label="Annotate Boxes"),
        gr.components.Checkbox(value=False, label="Annotate Masks"),
        ],
    outputs=gr.components.Image(type="numpy", label="Output Image"),
    title="Car Damage Detector",
    examples=SAMPLE["car-dam-det"],
    cache_examples=False,
)

car_sev_ui = gr.Interface(
    fn=car_sev_detector.transform,
    inputs=[ 
        gr.components.Image(type="filepath", label="Input Image"),
        gr.components.Checkbox(value=True, label="Annotate Boxes"),
        gr.components.Checkbox(value=False, label="Annotate Masks"),
        ],
    outputs=gr.components.Image(type="numpy", label="Output Image"),
    title="Car Damage Severity Detector",
    examples=SAMPLE["car-dam-sev-det"],
    cache_examples=False,
)

gr.TabbedInterface(
    [car_part_ui, car_dam_ui, car_sev_ui],
    tab_names=[
        'car part segmentation', 
        'car damage detection', 
        'car damage severity detection'
        ]
).queue().launch()