JRQi commited on
Commit
7a59c48
1 Parent(s): db9e998

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -6,9 +6,9 @@ import pandas as pd
6
  from transformers import AutoTokenizer, AutoModelForSequenceClassification, pipeline
7
 
8
 
9
- from game1 import read1, func1, interpre1, read1_written, func1_written
10
  from game2 import func2
11
- from game3 import func3
12
 
13
 
14
  def ret_en():
@@ -165,10 +165,8 @@ Choose one of the three tasks below ... and start to play!
165
  with gr.Row():
166
  # gr.Markdown(''' <p style="text-align: center;"> or </p> ''')
167
  sample_button_en_3 = gr.Button("Click to get a sentence.", size='sm')
168
-
169
  input_text_mf = gr.Textbox(label="Sentence:", value="HELLO! Hallo!", visible=False, container=False)
170
  interpretation_mf_1 = gr.components.Interpretation(input_text_mf)
171
-
172
  slider_3_1 = gr.Slider(label="Human: Male ——> Female", container=True, min_width=200, height=80, show_label=True, interactive=True)
173
  user_important_mf = gr.Textbox(label="Which words are the guesses based on?", placeholder="Enter words that you think are important.")
174
 
@@ -212,7 +210,12 @@ Choose one of the three tasks below ... and start to play!
212
  slider_3_4 = gr.Slider(label="AI: Male ——> Female", container=True, min_width=200, height=80, show_label=True, interactive=True)
213
  chatbot_mf_2 = gr.Chatbot(height=350, min_width=50, container=False) # height=300
214
 
 
 
 
 
215
 
 
216
 
217
  if __name__ == "__main__":
218
  demo.launch()
 
6
  from transformers import AutoTokenizer, AutoModelForSequenceClassification, pipeline
7
 
8
 
9
+ from game1 import read1, func1, interpre1, func1_written
10
  from game2 import func2
11
+ from game3 import read3, func3, interpre3, func3_written
12
 
13
 
14
  def ret_en():
 
165
  with gr.Row():
166
  # gr.Markdown(''' <p style="text-align: center;"> or </p> ''')
167
  sample_button_en_3 = gr.Button("Click to get a sentence.", size='sm')
 
168
  input_text_mf = gr.Textbox(label="Sentence:", value="HELLO! Hallo!", visible=False, container=False)
169
  interpretation_mf_1 = gr.components.Interpretation(input_text_mf)
 
170
  slider_3_1 = gr.Slider(label="Human: Male ——> Female", container=True, min_width=200, height=80, show_label=True, interactive=True)
171
  user_important_mf = gr.Textbox(label="Which words are the guesses based on?", placeholder="Enter words that you think are important.")
172
 
 
210
  slider_3_4 = gr.Slider(label="AI: Male ——> Female", container=True, min_width=200, height=80, show_label=True, interactive=True)
211
  chatbot_mf_2 = gr.Chatbot(height=350, min_width=50, container=False) # height=300
212
 
213
+ sample_button_en_3.click(read3, inputs=[num_selected_3], outputs=[interpretation_mf_1, num_selected_3])
214
+ num_selected_3.change(reset_modules, outputs=[interpretation_mf_2, slider_3_1, slider_3_2, chatbot_mf_1, user_important_mf])
215
+ chat_button_mf.click(func3, inputs=[num_selected_3, slider_3_1, num1, num2, user_important_mf], outputs=[slider_3_2, chatbot_mf_1, num1, num2, tot_scores])
216
+ interpre_button_mf.click(interpre3, inputs=[num_selected_3], outputs=[interpretation_mf_2])
217
 
218
+ chat_button_mf_2.click(func3_written, inputs=[text_written, slider_3_3], outputs=[interpretation_mf_4, slider_3_4, chatbot_mf_2])
219
 
220
  if __name__ == "__main__":
221
  demo.launch()