Spaces:
Running
Running
File size: 645 Bytes
49a3c14 c4497cb 49a3c14 c4497cb 49a3c14 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 dummy(img):
imageio.imwrite("output_image.png", img["mask"])
return img["image"], img["mask"]
with gr.Blocks() as demo:
gr.Markdown(
"""
# Image mask creator
This is a demo of a simple image mask creator. You can draw on the image and the mask will be created.
"""
)
with gr.Row():
img = gr.Image(tool="sketch", label="base image", width=512, height=512, show_label=True)
img1 = gr.Image()
img2 = gr.Image(label="mask image", show_label=True)
btn = gr.Button()
btn.click(dummy, img, [img1, img2])
demo.launch(debug=True)
|