File size: 554 Bytes
905342b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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()