JRQi commited on
Commit
952bac4
β€’
1 Parent(s): b4e4fff

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -40
app.py CHANGED
@@ -30,19 +30,7 @@ def reset_scores():
30
  # scroe_robot = ''' # Robot: ''' + str(int(0))
31
 
32
  # tooltip=["Role", "Scores"],
33
- return 0, 0, tot_scores, gr.BarPlot.update(
34
- data,
35
- x="Role",
36
- y="Scores",
37
- color="Role",
38
- vertical=False,
39
- y_lim=[0,10],
40
- color_legend_position='none',
41
- height=250,
42
- width=500,
43
- show_label=False,
44
- container=False,
45
- )
46
 
47
  def reset_modules():
48
  res_empty = {"original": "", "interpretation": []}
@@ -81,26 +69,25 @@ Choose one of the three tasks below ... and start to play!
81
 
82
  )
83
  with gr.Column():
84
- # plot = gr.BarPlot(height=120, width=300, container=False)
85
- data = pd.DataFrame(
86
- {
87
- "Role": ["AI πŸ€–", "HUMAN πŸ‘¨πŸ‘©"],
88
- "Scores": [0, 0],
89
- }
90
- )
91
- plot = gr.BarPlot(
92
- data,
93
- x="Role",
94
- y="Scores",
95
- color="Role",
96
- vertical=False,
97
- y_lim=[0,10],
98
- color_legend_position='none',
99
- height=250,
100
- width=500,
101
- show_label=False,
102
- container=False,
103
- )
104
  # tooltip=["Role", "Scores"],
105
 
106
  # button_reset = gr.Button("Reset Scores")
@@ -133,7 +120,7 @@ Choose one of the three tasks below ... and start to play!
133
  with gr.Column():
134
  with gr.Row():
135
  sample_button_en = gr.Button("Click to get a review in English.", size='sm')
136
- gr.Markdown(''' <p style="text-align: center;"> or </p> ''')
137
  # gr.Markdown(''' <h2 style="text-align: center;"> or </h2> ''')
138
  sample_button_nl = gr.Button("Click to get a review in Dutch.", size='sm')
139
 
@@ -205,15 +192,10 @@ Choose one of the three tasks below ... and start to play!
205
  slider_1_4 = gr.Slider(label="AI: Dislike β€”β€”> Like", container=True, min_width=200, height=80, show_label=True, interactive=True)
206
  chatbot2 = gr.Chatbot(height=350, min_width=50, container=False) # height=300
207
 
208
- # sample_button_en.click(read1, inputs=[text_en], outputs=[checkbox_1, interpretation1, lang_selected, num_selected, interpretation2, slider_1_1, slider_1_2, chatbot1])
209
- # sample_button_nl.click(read1, inputs=[text_nl], outputs=[checkbox_1, interpretation1, lang_selected, num_selected, interpretation2, slider_1_1, slider_1_2, chatbot1])
210
- # chat_button_1.click(func1, inputs=[lang_selected, num_selected, slider_1_1, num1, num2, checkbox_1], outputs=[slider_1_2, chatbot1, num1, num2, tot_scores, plot])
211
- # interpre_button.click(interpre1, inputs=[lang_selected, num_selected], outputs=[interpretation2])
212
-
213
  sample_button_en.click(read1, inputs=[text_en, num_selected], outputs=[interpretation1, lang_selected, num_selected])
214
  sample_button_nl.click(read1, inputs=[text_nl, num_selected], outputs=[interpretation1, lang_selected, num_selected])
215
  num_selected.change(reset_modules, outputs=[interpretation2, slider_1_1, slider_1_2, chatbot1, user_important])
216
- chat_button_1.click(func1, inputs=[lang_selected, num_selected, slider_1_1, num1, num2, user_important], outputs=[slider_1_2, chatbot1, num1, num2, tot_scores, plot])
217
  interpre_button.click(interpre1, inputs=[lang_selected, num_selected], outputs=[interpretation2])
218
 
219
  # sample_button_en_written.click(read1_written, inputs=[text_en], outputs=[text_written])
 
30
  # scroe_robot = ''' # Robot: ''' + str(int(0))
31
 
32
  # tooltip=["Role", "Scores"],
33
+ return 0, 0, tot_scores
 
 
 
 
 
 
 
 
 
 
 
 
34
 
35
  def reset_modules():
36
  res_empty = {"original": "", "interpretation": []}
 
69
 
70
  )
71
  with gr.Column():
72
+ # data = pd.DataFrame(
73
+ # {
74
+ # "Role": ["AI πŸ€–", "HUMAN πŸ‘¨πŸ‘©"],
75
+ # "Scores": [0, 0],
76
+ # }
77
+ # )
78
+ # plot = gr.BarPlot(
79
+ # data,
80
+ # x="Role",
81
+ # y="Scores",
82
+ # color="Role",
83
+ # vertical=False,
84
+ # y_lim=[0,10],
85
+ # color_legend_position='none',
86
+ # height=250,
87
+ # width=500,
88
+ # show_label=False,
89
+ # container=False,
90
+ # )
 
91
  # tooltip=["Role", "Scores"],
92
 
93
  # button_reset = gr.Button("Reset Scores")
 
120
  with gr.Column():
121
  with gr.Row():
122
  sample_button_en = gr.Button("Click to get a review in English.", size='sm')
123
+ # gr.Markdown(''' <p style="text-align: center;"> or </p> ''')
124
  # gr.Markdown(''' <h2 style="text-align: center;"> or </h2> ''')
125
  sample_button_nl = gr.Button("Click to get a review in Dutch.", size='sm')
126
 
 
192
  slider_1_4 = gr.Slider(label="AI: Dislike β€”β€”> Like", container=True, min_width=200, height=80, show_label=True, interactive=True)
193
  chatbot2 = gr.Chatbot(height=350, min_width=50, container=False) # height=300
194
 
 
 
 
 
 
195
  sample_button_en.click(read1, inputs=[text_en, num_selected], outputs=[interpretation1, lang_selected, num_selected])
196
  sample_button_nl.click(read1, inputs=[text_nl, num_selected], outputs=[interpretation1, lang_selected, num_selected])
197
  num_selected.change(reset_modules, outputs=[interpretation2, slider_1_1, slider_1_2, chatbot1, user_important])
198
+ chat_button_1.click(func1, inputs=[lang_selected, num_selected, slider_1_1, num1, num2, user_important], outputs=[slider_1_2, chatbot1, num1, num2, tot_scores])
199
  interpre_button.click(interpre1, inputs=[lang_selected, num_selected], outputs=[interpretation2])
200
 
201
  # sample_button_en_written.click(read1_written, inputs=[text_en], outputs=[text_written])