Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -5,7 +5,7 @@ import matplotlib.pyplot
|
|
5 |
import matplotlib.collections
|
6 |
import math
|
7 |
|
8 |
-
data = pandas.read_csv("1-s2.0-S2352340918302014-mmc2.csv")
|
9 |
|
10 |
def how_many_designs(team: int, participant: int):
|
11 |
n = len(numpy.unique(data[(data['Team'] == team) & (data['Participant'] == participant)]['Design']))
|
@@ -50,13 +50,16 @@ with gradio.Blocks() as demo:
|
|
50 |
team = gradio.Dropdown(choices=[str(i) for i in range(1,17)], value="1", label="Team Number")
|
51 |
participant = gradio.Dropdown(choices=[str(i) for i in range(1,4)], value="1", label="Teammate Number")
|
52 |
design = gradio.Slider(1, 100, step=1, value=1, label="Design Number")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
with gradio.Column():
|
54 |
output = gradio.Plot(value=print_design(1, 1, 1))
|
55 |
|
56 |
-
with gr.Row():
|
57 |
-
btn1 = gr.Button("Reverse", fn=lambda x: return x-1, inputs=[design], outputs=[design])
|
58 |
-
btn2 = gr.Button("Forward", fn=lambda x: return x+1, inputs=[design], outputs=[design])
|
59 |
-
|
60 |
team.change(fn=how_many_designs, inputs=[team, participant], outputs=[design])
|
61 |
participant.change(fn=how_many_designs, inputs=[team, participant], outputs=[design])
|
62 |
|
|
|
5 |
import matplotlib.collections
|
6 |
import math
|
7 |
|
8 |
+
data = pandas.read_csv("/1-s2.0-S2352340918302014-mmc2.csv")
|
9 |
|
10 |
def how_many_designs(team: int, participant: int):
|
11 |
n = len(numpy.unique(data[(data['Team'] == team) & (data['Participant'] == participant)]['Design']))
|
|
|
50 |
team = gradio.Dropdown(choices=[str(i) for i in range(1,17)], value="1", label="Team Number")
|
51 |
participant = gradio.Dropdown(choices=[str(i) for i in range(1,4)], value="1", label="Teammate Number")
|
52 |
design = gradio.Slider(1, 100, step=1, value=1, label="Design Number")
|
53 |
+
|
54 |
+
with gradio.Row():
|
55 |
+
btn1 = gradio.Button("⬅ Reverse", variant="secondary")
|
56 |
+
btn1.click(fn=lambda x: gradio.Slider.update(value=x-1), inputs=[design], outputs=[design])
|
57 |
+
btn2 = gradio.Button("Forward ⮕", variant="primary")
|
58 |
+
btn2.click(fn=lambda x: gradio.Slider.update(value=x+1), inputs=[design], outputs=[design])
|
59 |
+
|
60 |
with gradio.Column():
|
61 |
output = gradio.Plot(value=print_design(1, 1, 1))
|
62 |
|
|
|
|
|
|
|
|
|
63 |
team.change(fn=how_many_designs, inputs=[team, participant], outputs=[design])
|
64 |
participant.change(fn=how_many_designs, inputs=[team, participant], outputs=[design])
|
65 |
|