Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| import numpy as np | |
| def create_map(): | |
| return np.full((512, 1024), 255, dtype=np.uint8) | |
| def run(image): | |
| return image['mask'] | |
| with gr.Blocks() as demo: | |
| with gr.Row(): | |
| with gr.Column(): | |
| image = gr.Image(tool='sketch') | |
| clear_button = gr.Button('Clear') | |
| run_button = gr.Button('Run') | |
| with gr.Column(): | |
| result = gr.Image() | |
| clear_button.click(fn=create_map, outputs=image) | |
| run_button.click(fn=run, inputs=image, outputs=result) | |
| demo.queue().launch() | |