sleeper371 commited on
Commit
8cd6164
·
1 Parent(s): 416f659
Files changed (2) hide show
  1. app.py +1 -1
  2. event_handlers.py +4 -3
app.py CHANGED
@@ -79,7 +79,7 @@ with gr.Blocks(
79
  gr.Markdown("### Text Input")
80
  text_input_block = gr.Textbox(
81
  lines=30,
82
- placeholder="""If your text includes multiple long sentences, select a voice prompt to have consistent speech. \nPut one sentence on one line.\nDo not use long sentence, split them out to multiple sentences with each less than 15 seconds worth of speech""",
83
  label="Text Prompts",
84
  )
85
  generate_btn = gr.Button("Generate", variant="primary")
 
79
  gr.Markdown("### Text Input")
80
  text_input_block = gr.Textbox(
81
  lines=30,
82
+ placeholder="""Long text will be split to sentences using only a dot `.` as a separator. Make sure one sentence can be spoken in less than 13 seconds or the speech will be trim on the end. If input text with more than one sentence, make sure to choose a prompt to have consistent voice across sentences. All split sentences are running in one batch with a batch size equal to the number of sentences in the text, assuming zero GPU can take a very large batch size.""",
83
  label="Text Prompts",
84
  )
85
  generate_btn = gr.Button("Generate", variant="primary")
event_handlers.py CHANGED
@@ -348,7 +348,7 @@ def generate_batch_audio(
348
 
349
  generated_metadata = []
350
 
351
- bark_prompt = None
352
  if selected_prompt_name != "None":
353
  # gr.Info("Loading audio prompt...")
354
  prompt_path = os.path.join(PROMPT_DIR, selected_prompt_name)
@@ -364,9 +364,10 @@ def generate_batch_audio(
364
  )
365
 
366
  # split the text into sentences
367
- sentences = text.split("\n")
 
368
 
369
- gr.Info("Generating Audio....", duration=10)
370
  waves = generate_audio(
371
  texts=sentences,
372
  prompt=bark_prompt,
 
348
 
349
  generated_metadata = []
350
 
351
+ bark_prompt = os.path.join(PROMPT_DIR, "en_speaker_6.npz")
352
  if selected_prompt_name != "None":
353
  # gr.Info("Loading audio prompt...")
354
  prompt_path = os.path.join(PROMPT_DIR, selected_prompt_name)
 
364
  )
365
 
366
  # split the text into sentences
367
+ sentences = text.split(".")
368
+ sentences = [sentence.strip() for sentence in sentences]
369
 
370
+ gr.Info("Generating Audio....", duration=30)
371
  waves = generate_audio(
372
  texts=sentences,
373
  prompt=bark_prompt,