import gradio as gr import pandas as pd demo = gr.Blocks() data1 = pd.DataFrame({ "tool": ["tool1", "tool2", "tool3"], "error": [0.1, 0.2, 0.3] }) data2 = pd.DataFrame({ "tool": ["tool1", "tool2", "tool3", "tool4"], "error": [0.1, 0.2, 0.3, 0.4] }) data3 = pd.DataFrame({ "tool": ["tool1", "tool2", "tool3", "tool4", "tool5"], "error": [0.1, 0.2, 0.3, 0.4, 0.5] }) def update_plot1(): data = pd.DataFrame({ "tool": ["tool1", "tool2", "tool3", "tool4"], "error": [0.1, 0.2, 0.3, 0.4] }) return gr.BarPlot( data, x="tool", y="error" ) def update_plot2(): data = pd.DataFrame({ "tool": ["tool1", "tool2", "tool3", "tool4", "tool5"], "error": [0.1, 0.2, 0.3, 0.4, 0.5] }) return gr.BarPlot( data, x="tool", y="error" ) def update_plot3(): data = pd.DataFrame({ "tool": ["tool1", "tool2", "tool3", "tool4", "tool5", "tool6"], "error": [0.1, 0.2, 0.3, 0.4, 0.5, 0.6] }) return gr.BarPlot( data, x="tool", y="error" ) def update_plots(): return update_plot1(), update_plot2(), update_plot3() with demo: with gr.Row(): plot1 = gr.BarPlot( data1, x="tool", y="error" ) with gr.Row(): plot2 = gr.BarPlot( data2, x="tool", y="error" ) with gr.Row(): plot3 = gr.BarPlot( data3, x="tool", y="error" ) with gr.Row(): update_button = gr.Button("Update") update_button.click( update_plots, inputs=[], outputs=[plot1, plot2, plot3] ) demo.launch( debug=True )