Pendrokar commited on
Commit
f7cbc18
β€’
1 Parent(s): 21049ce

ARPAbet example

Browse files
Files changed (2) hide show
  1. app.py +18 -38
  2. gr_client.py +18 -20
app.py CHANGED
@@ -315,30 +315,23 @@ def set_default_text(lang, deepmoji_checked):
315
 
316
  return default_text[lang], checkbox_enabled # Return the modified textbox (important for Blocks)
317
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
318
  def set_example_as_input(example_text):
319
  return example_text
320
 
321
- def toggle_example_dropdown(lang):
322
- if lang == 'en':
323
- return gr.Dropdown(
324
- [
325
- "If there is anything else you need, feel free to ask.",
326
- "Amazing! Could you do that again?",
327
- "Why, I would be more than happy to help you!",
328
- "That was unexpected.",
329
- "How dare you! . You have no right.",
330
- "Ahh, well, you see. There is more to it.",
331
- "I can't believe she is gone.",
332
- "Stay out of my way!!!",
333
- ],
334
- label="Example dropdown",
335
- show_label=False,
336
- info="English Examples",
337
- visible=True
338
- )
339
- else:
340
- return gr.Dropdown(visible=False)
341
-
342
  def reset_em_sliders(
343
  deepmoji_enabled,
344
  anger,
@@ -412,19 +405,12 @@ with gr.Blocks(css=".arpabet {display: inline-block; background-color: gray; bor
412
  with gr.Row():
413
  with gr.Column():
414
  en_examples_dropdown = gr.Dropdown(
415
- [
416
- "If there is anything else you need, feel free to ask.",
417
- "Amazing! Could you do that again?",
418
- "Why, I would be more than happy to help you!",
419
- "That was unexpected.",
420
- "How dare you! . You have no right.",
421
- "Ahh, well, you see. There is more to it.",
422
- "I can't believe she is gone.",
423
- "Stay out of my way!!!",
424
- ],
425
  label="Example dropdown",
426
  show_label=False,
427
- info="English Examples"
 
428
  )
429
  with gr.Column():
430
  pacing_slider = gr.Slider(0.5, 2.0, value=1.0, step=0.1, label="Duration")
@@ -525,12 +511,6 @@ with gr.Blocks(css=".arpabet {display: inline-block; background-color: gray; bor
525
  outputs=[input_textbox]
526
  )
527
 
528
- language_radio.change(
529
- toggle_example_dropdown,
530
- inputs=language_radio,
531
- outputs=en_examples_dropdown
532
- )
533
-
534
  deepmoji_checkbox.change(
535
  toggle_deepmoji,
536
  inputs=[
 
315
 
316
  return default_text[lang], checkbox_enabled # Return the modified textbox (important for Blocks)
317
 
318
+ en_examples = [
319
+ "This is what my voice sounds like.",
320
+ "If there is anything else you need, feel free to ask.",
321
+ "Amazing! Could you do that again?",
322
+ "Why, I would be more than happy to help you!",
323
+ "That was unexpected.",
324
+ "How dare you! . You have no right.",
325
+ "Ahh, well, you see. There is more to it.",
326
+ "I can't believe she is gone.",
327
+ "Stay out of my way!!!",
328
+ # ARPAbet example
329
+ "This { IH1 Z } { W AH1 T } { M AY1 } { V OY1 S } { S AW1 N D Z } like.",
330
+ ]
331
+
332
  def set_example_as_input(example_text):
333
  return example_text
334
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
335
  def reset_em_sliders(
336
  deepmoji_enabled,
337
  anger,
 
405
  with gr.Row():
406
  with gr.Column():
407
  en_examples_dropdown = gr.Dropdown(
408
+ en_examples,
409
+ value=en_examples[0],
 
 
 
 
 
 
 
 
410
  label="Example dropdown",
411
  show_label=False,
412
+ info="English Examples",
413
+ visible=(language_radio.value == 'en')
414
  )
415
  with gr.Column():
416
  pacing_slider = gr.Slider(0.5, 2.0, value=1.0, step=0.1, label="Duration")
 
511
  outputs=[input_textbox]
512
  )
513
 
 
 
 
 
 
 
514
  deepmoji_checkbox.change(
515
  toggle_deepmoji,
516
  inputs=[
gr_client.py CHANGED
@@ -191,22 +191,28 @@ def set_default_text(lang, deepmoji_checked):
191
 
192
  return default_text[lang], checkbox_enabled # Return the modified textbox (important for Blocks)
193
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
194
  def set_example_as_input(example_text):
195
  return example_text
196
 
197
  def toggle_example_dropdown(lang):
198
  if lang == 'en':
199
  return gr.Dropdown(
200
- [
201
- "If there is anything else you need, feel free to ask.",
202
- "Amazing! Could you do that again?",
203
- "Why, I would be more than happy to help you!",
204
- "That was unexpected.",
205
- "How dare you! . You have no right.",
206
- "Ahh, well, you see. There is more to it.",
207
- "I can't believe she is gone.",
208
- "Stay out of my way!!!",
209
- ],
210
  label="Example dropdown",
211
  show_label=False,
212
  info="English Examples",
@@ -289,16 +295,8 @@ with gr.Blocks(css=".arpabet {background-color: gray; border-radius: 5px; font-s
289
  with gr.Row():
290
  with gr.Column():
291
  en_examples_dropdown = gr.Dropdown(
292
- [
293
- "If there is anything else you need, feel free to ask.",
294
- "Amazing! Could you do that again?",
295
- "Why, I would be more than happy to help you!",
296
- "That was unexpected.",
297
- "How dare you! . You have no right.",
298
- "Ahh, well, you see. There is more to it.",
299
- "I can't believe she is gone.",
300
- "Stay out of my way!!!",
301
- ],
302
  label="Example dropdown",
303
  show_label=False,
304
  info="English Examples"
 
191
 
192
  return default_text[lang], checkbox_enabled # Return the modified textbox (important for Blocks)
193
 
194
+ en_examples = [
195
+ "This is what my voice sounds like.",
196
+ "If there is anything else you need, feel free to ask.",
197
+ "Amazing! Could you do that again?",
198
+ "Why, I would be more than happy to help you!",
199
+ "That was unexpected.",
200
+ "How dare you! . You have no right.",
201
+ "Ahh, well, you see. There is more to it.",
202
+ "I can't believe she is gone.",
203
+ "Stay out of my way!!!",
204
+ # ARPAbet example
205
+ "This { IH1 Z } { W AH1 T } { M AY1 } { V OY1 S } { S AW1 N D Z } like.",
206
+ ]
207
+
208
  def set_example_as_input(example_text):
209
  return example_text
210
 
211
  def toggle_example_dropdown(lang):
212
  if lang == 'en':
213
  return gr.Dropdown(
214
+ en_examples,
215
+ value=en_examples[0],
 
 
 
 
 
 
 
 
216
  label="Example dropdown",
217
  show_label=False,
218
  info="English Examples",
 
295
  with gr.Row():
296
  with gr.Column():
297
  en_examples_dropdown = gr.Dropdown(
298
+ en_examples,
299
+ value=en_examples[0],
 
 
 
 
 
 
 
 
300
  label="Example dropdown",
301
  show_label=False,
302
  info="English Examples"