File size: 595 Bytes
49a3c14
773373e
49a3c14
56f16c7
e51a16d
 
49a3c14
 
56f16c7
 
 
 
 
 
 
 
 
 
49a3c14
56f16c7
 
c4497cb
 
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 gradio as gr
import imageio

def create_mask(image):
    imageio.imwrite("output_image.png", image["mask"])
    return image["mask"]

with gr.Blocks() as demo:
   gr.Markdown(
       """
       # Image Mask Creator
       Draw on the image to create a mask.
       """
   )

   with gr.Row():
       base_image = gr.Image(tool="sketch", label="Base Image", width=512, height=512, show_label=True)
       mask_image = gr.Image(label="Mask Image", show_label=True)

   btn = gr.Button("Create Mask")
   btn.click(create_mask, inputs=base_image, outputs=mask_image)

demo.launch(debug=True)