JRQi commited on
Commit
88800a6
β€’
1 Parent(s): 7888a36

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -22
app.py CHANGED
@@ -45,7 +45,7 @@ with gr.Blocks(theme=gr.themes.Default(text_size=gr.themes.sizes.text_md)) as de
45
  num1 = gr.Number(value=0, container=False, show_label=False, visible=False)
46
  num2 = gr.Number(value=0, container=False, show_label=False, visible=False)
47
 
48
- with gr.Column(scale=3):
49
  placeholder = gr.Markdown(
50
  ''' ## Welcome to the Language Model Explanation Challenge!
51
  Language Models (LMs) are powerful AI tools to understand and generate human language.<br />
@@ -90,7 +90,7 @@ with gr.Blocks(theme=gr.themes.Default(text_size=gr.themes.sizes.text_md)) as de
90
  num_selected_1 = gr.Number(value=0, container=False, show_label=False, visible=False)
91
 
92
  with gr.Row():
93
- with gr.Column(scale=1):
94
  with gr.Row():
95
  sample_button_en = gr.Button("Click to get a review in English.", size='sm')
96
  # gr.Markdown(''' <p style="text-align: center;"> or </p> ''')
@@ -133,7 +133,7 @@ with gr.Blocks(theme=gr.themes.Default(text_size=gr.themes.sizes.text_md)) as de
133
  )
134
 
135
  with gr.Row():
136
- with gr.Column():
137
  text_written = gr.Textbox(label="Review: ", placeholder="Enter your own review about a movie/restaurant/book.", visible=True)
138
  # image_1_3 = gr.Image('icon_user.png', height=80, width=80, min_width=80, show_label=False, show_share_button=False, interactive=False)
139
  slider_1_3 = gr.Slider(label="Human: Dislike β€”β€”> Like", container=True, min_width=200, height=80, show_label=True, interactive=True)
@@ -142,7 +142,8 @@ with gr.Blocks(theme=gr.themes.Default(text_size=gr.themes.sizes.text_md)) as de
142
  placeholder_written_text = gr.Textbox(label="Review: ", value="HELLO! Hallo!", visible=False)
143
  interpretation4 = gr.components.Interpretation(placeholder_written_text)
144
  slider_1_4 = gr.Slider(label="AI: Dislike β€”β€”> Like", container=True, min_width=200, height=80, show_label=True, interactive=True)
145
- chatbot2 = gr.Chatbot(height=350, min_width=50, container=False) # height=300
 
146
 
147
  sample_button_en.click(read1, inputs=[text_en, num_selected_1], outputs=[interpretation1, lang_selected, num_selected_1])
148
  sample_button_nl.click(read1, inputs=[text_nl, num_selected_1], outputs=[interpretation1, lang_selected, num_selected_1])
@@ -163,7 +164,7 @@ with gr.Blocks(theme=gr.themes.Default(text_size=gr.themes.sizes.text_md)) as de
163
  num_selected_3 = gr.Number(value=0, container=False, show_label=False, visible=False)
164
 
165
  with gr.Row():
166
- with gr.Column():
167
  with gr.Row():
168
  # gr.Markdown(''' <p style="text-align: center;"> or </p> ''')
169
  sample_button_en_3 = gr.Button("Click to get a sentence.", size='sm')
@@ -171,29 +172,30 @@ with gr.Blocks(theme=gr.themes.Default(text_size=gr.themes.sizes.text_md)) as de
171
  interpretation_mf_1 = gr.components.Interpretation(input_text_mf)
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
 
175
- gr.Markdown(
176
- ''' ## Male or Female
177
-
178
- You're given a sentence spoken by a speaker.
179
- The goal of this game is to guess the gender of the speaker, from 0 (=Male) to 100 (=Female).
180
-
181
- * Step 1. Get a sentence and guess the gender of the speaker.
182
-
183
- * Step 2. Check the gender guessed by AI. Who gets the most correct answer wins.
184
-
185
- * Step 3. Check the word highlighting to understand how AI made its decision.
186
- '''
187
- )
188
 
189
  with gr.Row():
190
- with gr.Column():
191
  chat_button_mf = gr.Button("Click to see AI's answer.", size='sm')
192
  slider_3_2 = gr.Slider(label="AI: Male β€”β€”> Female", container=True, min_width=200, height=80, show_label=True, interactive=True)
193
  interpre_button_mf = gr.Button("See how AI gets the answer.", size='sm')
194
  placeholder_text_mf = gr.Textbox(label="Sentence:", value="HELLO! Hallo!", visible=False)
195
  interpretation_mf_2 = gr.components.Interpretation(placeholder_text_mf)
196
- chatbot_mf_1 = gr.Chatbot(height=200, min_width=50, container=False) # height=300
 
197
  ####################################################################################################
198
  gr.Markdown(''' *** ''')
199
 
@@ -203,14 +205,15 @@ with gr.Blocks(theme=gr.themes.Default(text_size=gr.themes.sizes.text_md)) as de
203
  )
204
 
205
  with gr.Row():
206
- with gr.Column():
207
  text_written_mf = gr.Textbox(label="Sentence: ", placeholder="Enter your sentence.", visible=True)
208
  slider_3_3 = gr.Slider(label="Human: Male β€”β€”> Female", container=True, min_width=200, height=80, show_label=True, interactive=True)
209
  chat_button_mf_2 = gr.Button("Click to see AI's answer.", size='sm')
210
  placeholder_written_text_mf = gr.Textbox(label="Sentence: ", value="HELLO! Hallo!", visible=False)
211
  interpretation_mf_4 = gr.components.Interpretation(placeholder_written_text_mf)
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
  sample_button_en_3.click(read3, inputs=[num_selected_3], outputs=[interpretation_mf_1, num_selected_3])
216
  num_selected_3.change(reset_modules, outputs=[interpretation_mf_2, slider_3_1, slider_3_2, chatbot_mf_1, user_important_mf])
 
45
  num1 = gr.Number(value=0, container=False, show_label=False, visible=False)
46
  num2 = gr.Number(value=0, container=False, show_label=False, visible=False)
47
 
48
+ with gr.Column(scale=2):
49
  placeholder = gr.Markdown(
50
  ''' ## Welcome to the Language Model Explanation Challenge!
51
  Language Models (LMs) are powerful AI tools to understand and generate human language.<br />
 
90
  num_selected_1 = gr.Number(value=0, container=False, show_label=False, visible=False)
91
 
92
  with gr.Row():
93
+ with gr.Column(scale=2):
94
  with gr.Row():
95
  sample_button_en = gr.Button("Click to get a review in English.", size='sm')
96
  # gr.Markdown(''' <p style="text-align: center;"> or </p> ''')
 
133
  )
134
 
135
  with gr.Row():
136
+ with gr.Column(scale=2):
137
  text_written = gr.Textbox(label="Review: ", placeholder="Enter your own review about a movie/restaurant/book.", visible=True)
138
  # image_1_3 = gr.Image('icon_user.png', height=80, width=80, min_width=80, show_label=False, show_share_button=False, interactive=False)
139
  slider_1_3 = gr.Slider(label="Human: Dislike β€”β€”> Like", container=True, min_width=200, height=80, show_label=True, interactive=True)
 
142
  placeholder_written_text = gr.Textbox(label="Review: ", value="HELLO! Hallo!", visible=False)
143
  interpretation4 = gr.components.Interpretation(placeholder_written_text)
144
  slider_1_4 = gr.Slider(label="AI: Dislike β€”β€”> Like", container=True, min_width=200, height=80, show_label=True, interactive=True)
145
+ with gr.Column(scale=1):
146
+ chatbot2 = gr.Chatbot(height=350, min_width=50, container=False) # height=300
147
 
148
  sample_button_en.click(read1, inputs=[text_en, num_selected_1], outputs=[interpretation1, lang_selected, num_selected_1])
149
  sample_button_nl.click(read1, inputs=[text_nl, num_selected_1], outputs=[interpretation1, lang_selected, num_selected_1])
 
164
  num_selected_3 = gr.Number(value=0, container=False, show_label=False, visible=False)
165
 
166
  with gr.Row():
167
+ with gr.Column(scale=2):
168
  with gr.Row():
169
  # gr.Markdown(''' <p style="text-align: center;"> or </p> ''')
170
  sample_button_en_3 = gr.Button("Click to get a sentence.", size='sm')
 
172
  interpretation_mf_1 = gr.components.Interpretation(input_text_mf)
173
  slider_3_1 = gr.Slider(label="Human: Male β€”β€”> Female", container=True, min_width=200, height=80, show_label=True, interactive=True)
174
  user_important_mf = gr.Textbox(label="Which words are the guesses based on?", placeholder="Enter words that you think are important.")
175
+ with gr.Column(scale=1):
176
+ gr.Markdown(
177
+ ''' ## Male or Female
178
 
179
+ You're given a sentence spoken by a speaker.
180
+ The goal of this game is to guess the gender of the speaker, from 0 (=Male) to 100 (=Female).
181
+
182
+ * Step 1. Get a sentence and guess the gender of the speaker.
183
+
184
+ * Step 2. Check the gender guessed by AI. Who gets the most correct answer wins.
185
+
186
+ * Step 3. Check the word highlighting to understand how AI made its decision.
187
+ '''
188
+ )
 
 
 
189
 
190
  with gr.Row():
191
+ with gr.Column(scale=2):
192
  chat_button_mf = gr.Button("Click to see AI's answer.", size='sm')
193
  slider_3_2 = gr.Slider(label="AI: Male β€”β€”> Female", container=True, min_width=200, height=80, show_label=True, interactive=True)
194
  interpre_button_mf = gr.Button("See how AI gets the answer.", size='sm')
195
  placeholder_text_mf = gr.Textbox(label="Sentence:", value="HELLO! Hallo!", visible=False)
196
  interpretation_mf_2 = gr.components.Interpretation(placeholder_text_mf)
197
+ with gr.Column(scale=1):
198
+ chatbot_mf_1 = gr.Chatbot(height=200, min_width=50, container=False) # height=300
199
  ####################################################################################################
200
  gr.Markdown(''' *** ''')
201
 
 
205
  )
206
 
207
  with gr.Row():
208
+ with gr.Column(scale=2):
209
  text_written_mf = gr.Textbox(label="Sentence: ", placeholder="Enter your sentence.", visible=True)
210
  slider_3_3 = gr.Slider(label="Human: Male β€”β€”> Female", container=True, min_width=200, height=80, show_label=True, interactive=True)
211
  chat_button_mf_2 = gr.Button("Click to see AI's answer.", size='sm')
212
  placeholder_written_text_mf = gr.Textbox(label="Sentence: ", value="HELLO! Hallo!", visible=False)
213
  interpretation_mf_4 = gr.components.Interpretation(placeholder_written_text_mf)
214
  slider_3_4 = gr.Slider(label="AI: Male β€”β€”> Female", container=True, min_width=200, height=80, show_label=True, interactive=True)
215
+ with gr.Column(scale=1):
216
+ chatbot_mf_2 = gr.Chatbot(height=350, min_width=50, container=False) # height=300
217
 
218
  sample_button_en_3.click(read3, inputs=[num_selected_3], outputs=[interpretation_mf_1, num_selected_3])
219
  num_selected_3.change(reset_modules, outputs=[interpretation_mf_2, slider_3_1, slider_3_2, chatbot_mf_1, user_important_mf])