rime commited on
Commit
63d7087
·
verified ·
1 Parent(s): f997a91

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +29 -29
app.py CHANGED
@@ -497,25 +497,25 @@ MONOPOLY = [
497
  "We've added homes with craftsman-style woodwork to our offerings.",
498
  ]
499
 
500
- ASURION_TEXTS = SCHEDULE_ME + SUPERSIZED
501
- GOODCALL_TEXTS = SCHEDULE_ME
502
- CONVERSENEW_TEXTS = SUPERSIZED
503
- YLOPO_TEXTS = MONOPOLY
504
  RIME_TEXTS = SCHEDULE_ME + SUPERSIZED + MONOPOLY
505
 
506
  ivr_sid_to_name = {423: 'whirlpool', 836: 'sunrise', 2653: 'butterfly', 2654: 'rainfall', 2655: 'canyon', 2656: 'jungle', 2657: 'hills', 2658: 'lake', 3525: 'wildflower', 3529: 'peak', 3535: 'river', 3537: 'leaves', 3538: 'mountain', 3541: 'sky', 3542: 'valley', 3543: 'sunset', 3544: 'waterfall', 3545: 'pond', 3548: 'beach', 3549: 'oak', 3551: 'garden', 3552: 'stream', 3554: 'forest', 3555: 'breeze', 3558: 'meadow'}
507
- ASURION = [423, 836, 2653, 2654, 2655, 2656, 2657, 2658, 3525, 3529, 3535, 3537, 3538, 3541, 3542, 3543, 3544, 3545, 3548, 3549, 3551, 3552, 3554, 3555, 3558]
508
- GOODCALL = [2653, 2654, 2655, 2657, 3525, 3529, 3537, 3545, 3549, 3551, 3552]
509
- CONVERSENOW = [3525, 3529, 3535, 3538, 3542, 3543, 3544, 3545, 3549, 3551, 3552]
510
- YLOPO = [2653, 2654, 2655, 2656, 2657, 2658, 3535, 3537, 3544, 3545, 3549, 3552]
511
  RIME = [423, 836, 3525, 3529, 3535, 3537, 3538, 3541, 3542, 3543, 3544, 3545, 3548, 2653, 2654, 2655, 2656, 2657, 2658, 3549, 3551, 3552, 3554, 3555, 3558]
512
 
513
  def synthesize(key, text, speakers_must, speed, request: gr.Request):
514
  print("Requesting user: ", request.username)
515
- asurion_sids = ASURION
516
- goodcall_sids = GOODCALL
517
- conversenow_sids = CONVERSENOW
518
- ylopo_sids = YLOPO
519
  rime_sids = RIME
520
 
521
  sids_must = []
@@ -523,22 +523,22 @@ def synthesize(key, text, speakers_must, speed, request: gr.Request):
523
  N = 5
524
  if len(speakers_must) > 0:
525
  sids_must = [s.strip() for s in speakers_must.split(',')]
526
- if request.username == "asurion":
527
- sids_random = random.choices([s for s in asurion_sids if s not in sids_must], k=(N-len(sids_must)))
528
  if len(text) == 0:
529
- text = random.choice(ASURION_TEXTS)
530
- elif request.username == "goodcall":
531
- sids_random = random.choices([s for s in goodcall_sids if s not in sids_must], k=(N-len(sids_must)))
532
  if len(text) == 0:
533
- text = random.choice(GOODCALL_TEXTS)
534
- elif request.username == "conversenow":
535
- sids_random = random.choices([s for s in conversenow_sids if s not in sids_must], k=(N-len(sids_must)))
536
  if len(text) == 0:
537
- text = random.choice(CONVERSENEW_TEXTS)
538
- elif request.username == "ylopo":
539
- sids_random = random.choices([s for s in ylopo_sids if s not in sids_must], k=(N-len(sids_must)))
540
  if len(text) == 0:
541
- text = random.choice(YLOPO_TEXTS)
542
  elif request.username == "rime":
543
  sids_random = random.choices([s for s in rime_sids if s not in sids_must], k=(N-len(sids_must)))
544
  if len(text) == 0:
@@ -571,19 +571,19 @@ gradio_app = gr.Interface(
571
  fn=synthesize,
572
  inputs=[
573
  gr.Textbox(
574
- type="password", info="This is where you put your Rime TTS API key."
575
  ),
576
  gr.Textbox(
577
- info="Enter the text you want synthesized here. Check out our documentation for specifics and suggestions on text input!"
578
  ),
579
  gr.Textbox(
580
- info="Include speakers that you like, they will stay in the output."
581
  ),
582
- gr.Slider(0.8, 1.2, value=1, label="Speed"),
583
  ],
584
  outputs=["text", "audio", "text", "audio", "text", "audio", "text", "audio", "text", "audio", "text"],
585
  )
586
  gradio_app.launch(
587
  share=True,
588
- auth=[("asurion", "asurion"), ("goodcall", "goodcall"), ("conversenow", "conversenow"), ("ylopo", "ylopo"), ("rime", "rime")]
589
  )
 
497
  "We've added homes with craftsman-style woodwork to our offerings.",
498
  ]
499
 
500
+ PROCESSION_TEXTS = SCHEDULE_ME + SUPERSIZED
501
+ SCHEDULEME_TEXTS = SCHEDULE_ME
502
+ SUPERSIZED_TEXTS = SUPERSIZED
503
+ MONOPOLY_TEXTS = MONOPOLY
504
  RIME_TEXTS = SCHEDULE_ME + SUPERSIZED + MONOPOLY
505
 
506
  ivr_sid_to_name = {423: 'whirlpool', 836: 'sunrise', 2653: 'butterfly', 2654: 'rainfall', 2655: 'canyon', 2656: 'jungle', 2657: 'hills', 2658: 'lake', 3525: 'wildflower', 3529: 'peak', 3535: 'river', 3537: 'leaves', 3538: 'mountain', 3541: 'sky', 3542: 'valley', 3543: 'sunset', 3544: 'waterfall', 3545: 'pond', 3548: 'beach', 3549: 'oak', 3551: 'garden', 3552: 'stream', 3554: 'forest', 3555: 'breeze', 3558: 'meadow'}
507
+ PROCESSION = [423, 836, 2653, 2654, 2655, 2656, 2657, 2658, 3525, 3529, 3535, 3537, 3538, 3541, 3542, 3543, 3544, 3545, 3548, 3549, 3551, 3552, 3554, 3555, 3558]
508
+ SCHEDULEME = [2653, 2654, 2655, 2657, 3525, 3529, 3537, 3545, 3549, 3551, 3552]
509
+ SUPERSIZED = [3525, 3529, 3535, 3538, 3542, 3543, 3544, 3545, 3549, 3551, 3552]
510
+ MONOPOLY = [2653, 2654, 2655, 2656, 2657, 2658, 3535, 3537, 3544, 3545, 3549, 3552]
511
  RIME = [423, 836, 3525, 3529, 3535, 3537, 3538, 3541, 3542, 3543, 3544, 3545, 3548, 2653, 2654, 2655, 2656, 2657, 2658, 3549, 3551, 3552, 3554, 3555, 3558]
512
 
513
  def synthesize(key, text, speakers_must, speed, request: gr.Request):
514
  print("Requesting user: ", request.username)
515
+ procession_sids = PROCESSION
516
+ scheduleme_sids = SCHEDULEME
517
+ supersized_sids = SUPERSIZED
518
+ monopoly_sids = MONOPOLY
519
  rime_sids = RIME
520
 
521
  sids_must = []
 
523
  N = 5
524
  if len(speakers_must) > 0:
525
  sids_must = [s.strip() for s in speakers_must.split(',')]
526
+ if request.username == "procession":
527
+ sids_random = random.choices([s for s in procession_sids if s not in sids_must], k=(N-len(sids_must)))
528
  if len(text) == 0:
529
+ text = random.choice(PROCESSION_TEXTS)
530
+ elif request.username == "scheduleme":
531
+ sids_random = random.choices([s for s in scheduleme_sids if s not in sids_must], k=(N-len(sids_must)))
532
  if len(text) == 0:
533
+ text = random.choice(SCHEDULEME_TEXTS)
534
+ elif request.username == "supersized":
535
+ sids_random = random.choices([s for s in supersized_sids if s not in sids_must], k=(N-len(sids_must)))
536
  if len(text) == 0:
537
+ text = random.choice(SUPERSIZED_TEXTS)
538
+ elif request.username == "monopoly":
539
+ sids_random = random.choices([s for s in monopoly_sids if s not in sids_must], k=(N-len(sids_must)))
540
  if len(text) == 0:
541
+ text = random.choice(MONOPOLY_TEXTS)
542
  elif request.username == "rime":
543
  sids_random = random.choices([s for s in rime_sids if s not in sids_must], k=(N-len(sids_must)))
544
  if len(text) == 0:
 
571
  fn=synthesize,
572
  inputs=[
573
  gr.Textbox(
574
+ type="password", info="This is where you put your Rime TTS API key that was given to you by our team."
575
  ),
576
  gr.Textbox(
577
+ info="Enter the text you want synthesized here. If empty, will populate with a sentence at random."
578
  ),
579
  gr.Textbox(
580
+ info="Include speakers that you like, they will stay in the output, comma separated, for example: 'river,oak'"
581
  ),
582
+ gr.Slider(0.8, 1.2, value=1, label="Speed, higher is slower."),
583
  ],
584
  outputs=["text", "audio", "text", "audio", "text", "audio", "text", "audio", "text", "audio", "text"],
585
  )
586
  gradio_app.launch(
587
  share=True,
588
+ auth=[("procession", "procession"), ("scheduleme", "scheduleme"), ("supersized", "supersized"), ("monopoly", "monopoly"), ("rime", "rime")]
589
  )