File size: 507 Bytes
c117fae
 
 
 
acc7af8
c117fae
 
 
 
 
 
 
 
 
 
 
acc7af8
c117fae
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import gradio as gr

def draw_mask(img, h, w):
    return [
        img['image'].convert("RGB").resize((h, w)),
        img['mask'].convert("RGB").resize((h, w))
    ]

iface = gr.Interface(
    fn=draw_mask,
    inputs=[
        gr.Image(source="upload", tool='sketch', type='pil'),
        gr.Slider(label="height", minimum=256, maximum=1024, value=512),
        gr.Slider(label="width", minimum=256, maximum=1024, value=512),
    ], outputs=[
        gr.Image(),
        gr.Image(),
    ])
iface.launch()