arianna-bis commited on
Commit
6885547
β€’
1 Parent(s): 7706501

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -17
app.py CHANGED
@@ -46,7 +46,8 @@ with gr.Blocks(theme=gr.themes.Default(text_size=gr.themes.sizes.text_md)) as de
46
  num3 = gr.Number(value=0, container=False, show_label=False, visible=False)
47
  num4 = gr.Number(value=0, container=False, show_label=False, visible=False)
48
 
49
- with gr.Column(scale=2):
 
50
  placeholder = gr.Markdown(
51
  ''' ## Welcome to the Language Model Explanation Challenge!
52
  Language Models (LMs) are powerful AI tools to understand and generate human language.<br />
@@ -58,7 +59,7 @@ with gr.Blocks(theme=gr.themes.Default(text_size=gr.themes.sizes.text_md)) as de
58
  Can you outsmart the AI?<br />
59
  &rarr; Try to write a text that will trick it into the wrong decision<br /><br />
60
 
61
- Choose one of the three tasks below ... and start to play!
62
  '''
63
 
64
  #* **Like or Dislike** provides a movie/food/book review. You (and AI) are required to guess its score.
@@ -123,7 +124,7 @@ with gr.Blocks(theme=gr.themes.Default(text_size=gr.themes.sizes.text_md)) as de
123
  chat_button_1 = gr.Button("Click to see AI's rating", size='sm')
124
  slider_1_2 = gr.Slider(label="AI rating: Dislike(0) β€”> Like(100)", container=True, min_width=200, height=80, show_label=True, interactive=True)
125
  interpre_button = gr.Button("See how AI got its rating", size='sm')
126
- placeholder_text = gr.Textbox(label="Review: (Red: Positive; Blue: Negative)", value="HELLO! Hallo!", visible=False)
127
  interpretation2 = gr.components.Interpretation(placeholder_text)
128
  with gr.Column(scale=1):
129
  chatbot1 = gr.Chatbot(height=230, min_width=50, container=False) # height=300
@@ -142,7 +143,7 @@ with gr.Blocks(theme=gr.themes.Default(text_size=gr.themes.sizes.text_md)) as de
142
  slider_1_3 = gr.Slider(label="Your rating: Dislike(0) β€”> Like(100)", container=True, min_width=200, height=80, show_label=True, interactive=True)
143
  lang_written = gr.Radio(["English", "Dutch"], label="Language:", info="In which language is the review written?")
144
  chat_button_2 = gr.Button("Click to see AI's rating", size='sm')
145
- placeholder_written_text = gr.Textbox(label="Review: (Red: Positive; Blue: Negative)", value="HELLO! Hallo!", visible=False)
146
  interpretation4 = gr.components.Interpretation(placeholder_written_text)
147
  slider_1_4 = gr.Slider(label="AI rating: Dislike(0) β€”> Like(100)", container=True, min_width=200, height=80, show_label=True, interactive=True)
148
  with gr.Column(scale=1):
@@ -173,7 +174,7 @@ with gr.Blocks(theme=gr.themes.Default(text_size=gr.themes.sizes.text_md)) as de
173
  sample_button_en_3 = gr.Button("Click to get a sentence", size='sm')
174
  input_text_mf = gr.Textbox(label="Sentence:", value="HELLO! Hallo!", visible=False, container=False)
175
  interpretation_mf_1 = gr.components.Interpretation(input_text_mf)
176
- slider_3_1 = gr.Slider(label="Human: Male β€”β€”> Female", container=True, min_width=200, height=80, show_label=True, interactive=True)
177
  user_important_mf = gr.Textbox(label="Which words are your guesses based on?", placeholder="Enter words that you think are important for the task")
178
  with gr.Column(scale=1):
179
  gr.Markdown(
@@ -189,9 +190,9 @@ with gr.Blocks(theme=gr.themes.Default(text_size=gr.themes.sizes.text_md)) as de
189
  You're given a sentence spoken by a speaker.
190
  The goal of this game is to guess the gender of the speaker, from 0 (=Male) to 100 (=Female).
191
 
192
- * Step 1. Get a sentence and guess the gender of the speaker.
193
 
194
- * Step 2. Check the gender guessed by AI. Who gets the most correct answer wins.
195
 
196
  * Step 3. Check the word highlighting to understand how AI made its decision.
197
  '''
@@ -199,10 +200,10 @@ with gr.Blocks(theme=gr.themes.Default(text_size=gr.themes.sizes.text_md)) as de
199
 
200
  with gr.Row():
201
  with gr.Column(scale=2):
202
- chat_button_mf = gr.Button("Click to see AI's answer.", size='sm')
203
- slider_3_2 = gr.Slider(label="AI: Male β€”β€”> Female", container=True, min_width=200, height=80, show_label=True, interactive=True)
204
- interpre_button_mf = gr.Button("See how AI gets the answer.", size='sm')
205
- placeholder_text_mf = gr.Textbox(label="Sentence: (Red: Female; Blue: Male)", value="HELLO! Hallo!", visible=False)
206
  interpretation_mf_2 = gr.components.Interpretation(placeholder_text_mf)
207
  with gr.Column(scale=1):
208
  chatbot_mf_1 = gr.Chatbot(height=230, min_width=50, container=False)
@@ -210,18 +211,18 @@ with gr.Blocks(theme=gr.themes.Default(text_size=gr.themes.sizes.text_md)) as de
210
  gr.Markdown(''' *** ''')
211
 
212
  gr.Markdown(
213
- ''' # Now try your own sentence!
214
  '''
215
  )
216
 
217
  with gr.Row():
218
  with gr.Column(scale=2):
219
- text_written_mf = gr.Textbox(label="Sentence: ", placeholder="Enter your sentence.", visible=True)
220
- slider_3_3 = gr.Slider(label="Human: Male β€”β€”> Female", container=True, min_width=200, height=80, show_label=True, interactive=True)
221
- chat_button_mf_2 = gr.Button("Click to see AI's answer.", size='sm')
222
- placeholder_written_text_mf = gr.Textbox(label="Sentence: (Red: Female; Blue: Male)", value="HELLO! Hallo!", visible=False)
223
  interpretation_mf_4 = gr.components.Interpretation(placeholder_written_text_mf)
224
- slider_3_4 = gr.Slider(label="AI: Male β€”β€”> Female", container=True, min_width=200, height=80, show_label=True, interactive=True)
225
  with gr.Column(scale=1):
226
  chatbot_mf_2 = gr.Chatbot(height=350, min_width=50, container=False) # height=300
227
 
 
46
  num3 = gr.Number(value=0, container=False, show_label=False, visible=False)
47
  num4 = gr.Number(value=0, container=False, show_label=False, visible=False)
48
 
49
+ # with gr.Column(scale=2):
50
+ with gr.Column():
51
  placeholder = gr.Markdown(
52
  ''' ## Welcome to the Language Model Explanation Challenge!
53
  Language Models (LMs) are powerful AI tools to understand and generate human language.<br />
 
59
  Can you outsmart the AI?<br />
60
  &rarr; Try to write a text that will trick it into the wrong decision<br /><br />
61
 
62
+ Choose one of the tasks below ... and start to play!
63
  '''
64
 
65
  #* **Like or Dislike** provides a movie/food/book review. You (and AI) are required to guess its score.
 
124
  chat_button_1 = gr.Button("Click to see AI's rating", size='sm')
125
  slider_1_2 = gr.Slider(label="AI rating: Dislike(0) β€”> Like(100)", container=True, min_width=200, height=80, show_label=True, interactive=True)
126
  interpre_button = gr.Button("See how AI got its rating", size='sm')
127
+ placeholder_text = gr.Textbox(label="Red higlights: Positive / Blue higlights: Negative", value="HELLO! Hallo!", visible=False)
128
  interpretation2 = gr.components.Interpretation(placeholder_text)
129
  with gr.Column(scale=1):
130
  chatbot1 = gr.Chatbot(height=230, min_width=50, container=False) # height=300
 
143
  slider_1_3 = gr.Slider(label="Your rating: Dislike(0) β€”> Like(100)", container=True, min_width=200, height=80, show_label=True, interactive=True)
144
  lang_written = gr.Radio(["English", "Dutch"], label="Language:", info="In which language is the review written?")
145
  chat_button_2 = gr.Button("Click to see AI's rating", size='sm')
146
+ placeholder_written_text = gr.Textbox(label="Red higlights: Positive / Blue higlights: Negative", value="HELLO! Hallo!", visible=False)
147
  interpretation4 = gr.components.Interpretation(placeholder_written_text)
148
  slider_1_4 = gr.Slider(label="AI rating: Dislike(0) β€”> Like(100)", container=True, min_width=200, height=80, show_label=True, interactive=True)
149
  with gr.Column(scale=1):
 
174
  sample_button_en_3 = gr.Button("Click to get a sentence", size='sm')
175
  input_text_mf = gr.Textbox(label="Sentence:", value="HELLO! Hallo!", visible=False, container=False)
176
  interpretation_mf_1 = gr.components.Interpretation(input_text_mf)
177
+ slider_3_1 = gr.Slider(label="Your rating of author identity: Male(0) β€”β€”> Female(100)", container=True, min_width=200, height=80, show_label=True, interactive=True)
178
  user_important_mf = gr.Textbox(label="Which words are your guesses based on?", placeholder="Enter words that you think are important for the task")
179
  with gr.Column(scale=1):
180
  gr.Markdown(
 
190
  You're given a sentence spoken by a speaker.
191
  The goal of this game is to guess the gender of the speaker, from 0 (=Male) to 100 (=Female).
192
 
193
+ *Step 1. Get a sentence and guess the gender of the speaker.
194
 
195
+ *Step 2. Check the gender guessed by AI. Who gets the most correct answer wins.
196
 
197
  * Step 3. Check the word highlighting to understand how AI made its decision.
198
  '''
 
200
 
201
  with gr.Row():
202
  with gr.Column(scale=2):
203
+ chat_button_mf = gr.Button("Click to see AI's guess", size='sm')
204
+ slider_3_2 = gr.Slider(label="AI guess on author identity: Male(0) β€”β€”> Female(100)", container=True, min_width=200, height=80, show_label=True, interactive=True)
205
+ interpre_button_mf = gr.Button("See how AI made its guess", size='sm')
206
+ placeholder_text_mf = gr.Textbox(label="Red higlights: Female / Blue higlights: Male", value="HELLO! Hallo!", visible=False)
207
  interpretation_mf_2 = gr.components.Interpretation(placeholder_text_mf)
208
  with gr.Column(scale=1):
209
  chatbot_mf_1 = gr.Chatbot(height=230, min_width=50, container=False)
 
211
  gr.Markdown(''' *** ''')
212
 
213
  gr.Markdown(
214
+ ''' # Now try with your own sentence!
215
  '''
216
  )
217
 
218
  with gr.Row():
219
  with gr.Column(scale=2):
220
+ text_written_mf = gr.Textbox(label="Sentence: ", placeholder="Enter a sentence.", visible=True)
221
+ slider_3_3 = gr.Slider(label="Your rating of author identity: Male(0) β€”β€”> Female(100)", container=True, min_width=200, height=80, show_label=True, interactive=True)
222
+ chat_button_mf_2 = gr.Button("Click to see AI's guess", size='sm')
223
+ placeholder_written_text_mf = gr.Textbox(label="Red higlights: Female / Blue higlights: Male", value="HELLO! Hallo!", visible=False)
224
  interpretation_mf_4 = gr.components.Interpretation(placeholder_written_text_mf)
225
+ slider_3_4 = gr.Slider(label="AI guess on author identity: Male β€”β€”> Female", container=True, min_width=200, height=80, show_label=True, interactive=True)
226
  with gr.Column(scale=1):
227
  chatbot_mf_2 = gr.Chatbot(height=350, min_width=50, container=False) # height=300
228