mrfakename commited on
Commit
f1fda32
β€’
1 Parent(s): 9147ab8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -2
app.py CHANGED
@@ -13,10 +13,11 @@ from huggingface_hub import CommitScheduler, delete_file, hf_hub_download
13
  from gradio_client import Client
14
  from detoxify import Detoxify
15
  toxicity = Detoxify('original')
 
 
16
  ####################################
17
  # Constants
18
  ####################################
19
-
20
  AVAILABLE_MODELS = {
21
  'XTTS': 'xttsv2',
22
  'WhisperSpeech': 'whisperspeech',
@@ -478,13 +479,18 @@ def synthandreturn(text):
478
  gr.update(visible=False),
479
  gr.update(visible=False), #nxt round btn
480
  )
 
 
481
  def clear_stuff():
482
  return "", "Synthesize", gr.update(visible=False), '', '', gr.update(visible=False), gr.update(visible=False), gr.update(visible=False), gr.update(visible=False), gr.update(visible=False), gr.update(visible=False), gr.update(visible=False)
483
  with gr.Blocks() as vote:
484
  useridstate = gr.State()
485
  gr.Markdown(INSTR)
486
  with gr.Group():
487
- text = gr.Textbox(label="Enter text to synthesize", info="By entering text, you certify that it is either in the public domain or, if you are its author, you dedicate it into the public domain. You also must agree to the privacy statement in the About page.")
 
 
 
488
  btn = gr.Button("Synthesize", variant='primary')
489
  model1 = gr.Textbox(interactive=False, lines=1, max_lines=1, visible=False)
490
  model2 = gr.Textbox(interactive=False, lines=1, max_lines=1, visible=False)
 
13
  from gradio_client import Client
14
  from detoxify import Detoxify
15
  toxicity = Detoxify('original')
16
+ with open('harvard_sentences.txt') as f:
17
+ sents = f.read().strip().splitlines()
18
  ####################################
19
  # Constants
20
  ####################################
 
21
  AVAILABLE_MODELS = {
22
  'XTTS': 'xttsv2',
23
  'WhisperSpeech': 'whisperspeech',
 
479
  gr.update(visible=False),
480
  gr.update(visible=False), #nxt round btn
481
  )
482
+ def randomsent():
483
+ return random.choice(sents), '🎲'
484
  def clear_stuff():
485
  return "", "Synthesize", gr.update(visible=False), '', '', gr.update(visible=False), gr.update(visible=False), gr.update(visible=False), gr.update(visible=False), gr.update(visible=False), gr.update(visible=False), gr.update(visible=False)
486
  with gr.Blocks() as vote:
487
  useridstate = gr.State()
488
  gr.Markdown(INSTR)
489
  with gr.Group():
490
+ with gr.Row():
491
+ text = gr.Textbox(label="Enter text to synthesize", info="By entering text, you certify that it is either in the public domain or, if you are its author, you dedicate it into the public domain. You also must agree to the privacy statement in the About page.")
492
+ randomt = gr.Button('🎲')
493
+ randomt.click(randomsent, outputs=[text, randomt])
494
  btn = gr.Button("Synthesize", variant='primary')
495
  model1 = gr.Textbox(interactive=False, lines=1, max_lines=1, visible=False)
496
  model2 = gr.Textbox(interactive=False, lines=1, max_lines=1, visible=False)