Spaces:
Build error
Build error
Add description
Browse filesSigned-off-by: Aisuko <urakiny@gmail.com>
app.py
CHANGED
|
@@ -2,15 +2,22 @@ import gradio as gr
|
|
| 2 |
import imageio
|
| 3 |
|
| 4 |
def dummy(img):
|
| 5 |
-
|
| 6 |
-
|
| 7 |
|
| 8 |
with gr.Blocks() as demo:
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
|
| 16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
import imageio
|
| 3 |
|
| 4 |
def dummy(img):
|
| 5 |
+
imageio.imwrite("output_image.png", img["mask"])
|
| 6 |
+
return img["image"], img["mask"]
|
| 7 |
|
| 8 |
with gr.Blocks() as demo:
|
| 9 |
+
gr.Markdown(
|
| 10 |
+
"""
|
| 11 |
+
# Image mask creator
|
| 12 |
+
This is a demo of a simple image mask creator. You can draw on the image and the mask will be created.
|
| 13 |
+
"""
|
| 14 |
+
)
|
| 15 |
|
| 16 |
+
with gr.Row():
|
| 17 |
+
img = gr.Image(tool="sketch", label="base image", width=512, height=512, show_label=True)
|
| 18 |
+
img1 = gr.Image()
|
| 19 |
+
img2 = gr.Image(label="mask image", show_label=True)
|
| 20 |
+
btn = gr.Button()
|
| 21 |
+
btn.click(dummy, img, [img1, img2])
|
| 22 |
+
|
| 23 |
+
demo.launch(debug=True)
|