Spaces:
Sleeping
Sleeping
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) | |