gradio/demo/dataframe_block-ui-test/run.ipynb
Archit-Kohli 921716f618
Fixed visibility issue for all notebooks on GitHub (#5917)
* fixed visibility error in notebooks in github

* Delete fixNotebooks.py

deleted script used to fix notebooks

* Update generate_notebooks.py

fixed a small bug that prevented visibility of notebooks in GitHub
2023-10-15 18:16:57 -07:00

1.0 KiB

Gradio Demo: dataframe_block-ui-test

In [ ]:
!pip install -q gradio 
In [ ]:
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()