File size: 778 Bytes
bcc0f94
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b106d92
fb11cf7
 
 
 
 
 
 
 
bcc0f94
 
 
 
fb11cf7
 
 
 
bcc0f94
 
 
fb11cf7
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
import os

import gradio as gr

from src.run.unet.inference import ResUnetInfer


infer = ResUnetInfer(
    model_path="./checkpoint/resunet/decoder.pt",
    config_path="./src/models/unet/config/resnet_config.yml",
)

demo = gr.Interface(
    fn=infer.infer,
    inputs=[
        gr.Image(
            shape=(224, 224),
            label="Input Image",
            value="./sample/dog.jpeg",
        ),
        gr.Slider(
            minimum=0,
            maximum=1,
            value=0.5,
            label="Mask Transparency",
            info="Mask transparency for image segmentation overlay",
        ),
    ],
    outputs=[
        gr.Image(),
    ],
    examples=[
        [os.path.join("./sample/", f)]
        for f in os.listdir("./sample/")
    ],
)


demo.launch()