Spaces:
Build error
Build error
Download app.py from hmb/multiple-df-cell-select: direct link, hf CLI and curl.
- Browser
- Download file 611 Bytes
-
https://huggingface.co/spaces/hmb/multiple-df-cell-select/resolve/main/app.py
- Command line
-
hf download hf://spaces/hmb/multiple-df-cell-select/app.py
-
curl -L -o app.py https://huggingface.co/spaces/hmb/multiple-df-cell-select/resolve/main/app.py
611 Bytes
| import time | |
| import pandas as pd | |
| import gradio as gr | |
| with gr.Blocks() as blocks: | |
| def update_first_df(df): | |
| print('update first df') | |
| time.sleep(1) | |
| return df + 1 | |
| def update_second_df(df): | |
| print('update second df') | |
| time.sleep(1) | |
| return df + 1 | |
| first_df = gr.Dataframe(pd.DataFrame({'A': [1], 'B': [2]})) | |
| second_df = gr.Dataframe(pd.DataFrame({'A': [3], 'B': [4]})) | |
| first_df.select(fn=update_second_df, inputs=[second_df], outputs=[second_df]) | |
| second_df.select(fn=update_first_df, inputs=[first_df], outputs=[first_df]) | |
| blocks.launch() |