File size: 723 Bytes
45b7dee
 
 
 
 
 
 
e04da3e
307dfdb
e04da3e
45b7dee
 
 
f3beccb
307dfdb
 
 
 
e04da3e
f3beccb
 
45b7dee
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import numpy as np
import gradio as gr
from model import SegmentationTool

seg_tool = SegmentationTool()


def segment(input_img, mask_items):
    mask_image, transparent_mask_image, image, items, room = (
        seg_tool.get_mask(image=input_img, mask_items=mask_items))
    return mask_image


demo = gr.Interface(fn=segment,
                    inputs=[
                        gr.Image(type='pil'),
                        gr.CheckboxGroup([("Door", 14), ("Window", 8)],
                                         value=[8, 14],
                                         label="Mask Items")],
                    outputs=['image'],
                    allow_flagging='never')
if __name__ == "__main__":
    demo.launch()