Spaces:
Running
Running
File size: 374 Bytes
dccda73 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
import gradio as gr
import numpy as np
counter = -1
COLORS = [(255, 0, 0), (0, 255, 0), (0, 0, 255)]
def fn():
global counter
counter = (counter + 1) % 3
return np.full((300, 300, 3), COLORS[counter], dtype=np.uint8)
with gr.Blocks() as demo:
btn = gr.Button()
out = gr.Image()
gr.DeepLinkButton()
btn.click(fn=fn, outputs=out)
demo.launch() |