Spaces:
Sleeping
Sleeping
| 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() |