gradio/demo/dataframe_block-ui-test/run.py
Greysuki 1439b72f66
UI stuck caused by the 'selected' of DataFrame not being reset (#3916)
* dataframe error fix

* changelog

* demo launch fix
2023-04-20 10:27:52 -04:00

16 lines
428 B
Python

import gradio as gr
with gr.Blocks() as demo:
count = gr.Slider(minimum=1, maximum=10, step=1, label="count")
data = gr.DataFrame(
headers=["A", "B"], col_count=(2, "fixed"), type="array", interactive=True
)
btn = gr.Button(value="click")
btn.click(
fn=lambda cnt: [[str(2 * i), str(2 * i + 1)] for i in range(int(cnt))],
inputs=[count],
outputs=[data],
)
demo.launch()