File size: 1,795 Bytes
7724f8b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
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
)