JRQi commited on
Commit
598a5e3
1 Parent(s): f97043f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -2
app.py CHANGED
@@ -43,6 +43,11 @@ def reset_scores():
43
  show_label=False,
44
  container=False,
45
  )
 
 
 
 
 
46
  with gr.Blocks(theme=gr.themes.Default(text_size=gr.themes.sizes.text_md)) as demo:
47
  pre_load_1 = pipeline("sentiment-analysis", model="nlptown/bert-base-multilingual-uncased-sentiment")
48
 
@@ -204,8 +209,9 @@ Choose one of the three tasks below ... and start to play!
204
  # 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])
205
  # interpre_button.click(interpre1, inputs=[lang_selected, num_selected], outputs=[interpretation2])
206
 
207
- sample_button_en.click(read1, inputs=[text_en], outputs=[interpretation1, lang_selected, num_selected, interpretation2, slider_1_1, slider_1_2, chatbot1, user_important])
208
- sample_button_nl.click(read1, inputs=[text_nl], outputs=[interpretation1, lang_selected, num_selected, interpretation2, slider_1_1, slider_1_2, chatbot1, user_important])
 
209
  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])
210
  interpre_button.click(interpre1, inputs=[lang_selected, num_selected], outputs=[interpretation2])
211
 
 
43
  show_label=False,
44
  container=False,
45
  )
46
+
47
+ def reset_modules():
48
+ res_empty = {"original": "", "interpretation": []}
49
+ return res_empty, 0, 0, [], ""
50
+
51
  with gr.Blocks(theme=gr.themes.Default(text_size=gr.themes.sizes.text_md)) as demo:
52
  pre_load_1 = pipeline("sentiment-analysis", model="nlptown/bert-base-multilingual-uncased-sentiment")
53
 
 
209
  # 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])
210
  # interpre_button.click(interpre1, inputs=[lang_selected, num_selected], outputs=[interpretation2])
211
 
212
+ sample_button_en.click(read1, inputs=[text_en], outputs=[interpretation1, lang_selected, num_selected])
213
+ sample_button_nl.click(read1, inputs=[text_nl], outputs=[interpretation1, lang_selected, num_selected])
214
+ interpretation1.change(reset_modules, outputs=[interpretation2, slider_1_1, slider_1_2, chatbot1, user_important])
215
  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])
216
  interpre_button.click(interpre1, inputs=[lang_selected, num_selected], outputs=[interpretation2])
217