File size: 581 Bytes
06b48bf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import gradio as gr
import os

def fn(mask):
    return [mask["image"], mask["mask"]]


demo = gr.Blocks()

with demo:
    with gr.Row():
        with gr.Column():
            img = gr.Image(
                tool="sketch", source="upload", label="Mask", value=os.path.join(os.path.dirname(__file__), "lion.jpg")
            )
            with gr.Row():
                btn = gr.Button("Run")
        with gr.Column():
            img2 = gr.Image()
            img3 = gr.Image()

    btn.click(fn=fn, inputs=img, outputs=[img2, img3])


if __name__ == "__main__":
    demo.launch()