deeplinkbutton / app.py
hysts's picture
hysts HF Staff
Create app.py
dccda73 verified
raw
history blame contribute delete
374 Bytes
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()