kevinwang676 commited on
Commit
347a2f9
1 Parent(s): bc98707

add voice cloning

Browse files
Files changed (1) hide show
  1. app.py +22 -16
app.py CHANGED
@@ -300,6 +300,22 @@ while run_server:
300
  with gr.Column():
301
  gr.HTML(create_version_html(), elem_id="versions")
302
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
303
  with gr.Tab("TTS"):
304
  with gr.Row():
305
  with gr.Column():
@@ -338,6 +354,8 @@ while run_server:
338
  with gr.Column():
339
  gr.Markdown("[Voice Prompt Library](https://suno-ai.notion.site/8b8e8749ed514b0cbf3f699013548683?v=bc67cff786b04b50b3ceb756fd05f68c)")
340
  speaker = gr.Dropdown(speakers_list, value=speakers_list[0], label="Voice")
 
 
341
  with gr.Column():
342
  text_temp = gr.Slider(0.1, 1.0, value=0.6, label="Generation Temperature", info="1.0 more diverse, 0.1 more conservative")
343
  waveform_temp = gr.Slider(0.1, 1.0, value=0.7, label="Waveform temperature", info="1.0 more diverse, 0.1 more conservative")
@@ -353,6 +371,7 @@ while run_server:
353
  with gr.Row():
354
  with gr.Column():
355
  tts_create_button = gr.Button("Generate")
 
356
  with gr.Column():
357
  hidden_checkbox = gr.Checkbox(visible=False)
358
  button_stop_generation = gr.Button("Stop generation")
@@ -374,22 +393,6 @@ while run_server:
374
  with gr.Row():
375
  output_swap = gr.Audio(label="Generated Audio", type="filepath")
376
 
377
- with gr.Tab("Clone Voice"):
378
- with gr.Row():
379
- input_audio_filename = gr.Audio(label="Input audio.wav", source="upload", type="filepath")
380
- #transcription_text = gr.Textbox(label="Transcription Text", lines=1, placeholder="Enter Text of your Audio Sample here...")
381
- with gr.Row():
382
- with gr.Column():
383
- initialname = "Custom_Voice"
384
- output_voice = gr.Textbox(label="Filename of trained Voice", lines=1, placeholder=initialname, value=initialname)
385
- with gr.Column():
386
- tokenizerlang = gr.Dropdown(tokenizer_language_list, label="Base Language Tokenizer", value=tokenizer_language_list[1])
387
- with gr.Row():
388
- clone_voice_button = gr.Button("Create Voice")
389
- with gr.Row():
390
- dummy = gr.Text(label="Progress")
391
- npz_file = gr.File(label=".npz file")
392
-
393
  with gr.Tab("Training Data Prepare"):
394
  gr.Markdown("This tab should be used to generate the training dataset. For Step 1 put some books into the inputtext folder in UTF-8 Text Format.")
395
  prepare_semantics_number = gr.Number(label="Number of semantics to create", precision=0, value=3079)
@@ -438,6 +441,9 @@ while run_server:
438
  convert_to_ssml_button.click(convert_text_to_ssml, inputs=[input_text, speaker],outputs=input_text)
439
  gen_click = tts_create_button.click(generate_text_to_speech, inputs=[input_text, speaker, text_temp, waveform_temp, eos_prob, quick_gen_checkbox, complete_settings, seedcomponent, batchcount],outputs=output_audio)
440
  button_stop_generation.click(fn=None, inputs=None, outputs=None, cancels=[gen_click])
 
 
 
441
  # Javascript hack to display modal confirmation dialog
442
  js = "(x) => confirm('Are you sure? This will remove all files from output folder')"
443
  button_delete_files.click(None, None, hidden_checkbox, _js=js)
 
300
  with gr.Column():
301
  gr.HTML(create_version_html(), elem_id="versions")
302
 
303
+ with gr.Tab("Clone Voice"):
304
+ with gr.Row():
305
+ input_audio_filename = gr.Audio(label="Input audio.wav", source="upload", type="filepath")
306
+ #transcription_text = gr.Textbox(label="Transcription Text", lines=1, placeholder="Enter Text of your Audio Sample here...")
307
+ with gr.Row():
308
+ with gr.Column():
309
+ initialname = "Custom_Voice"
310
+ output_voice = gr.Textbox(label="Filename of trained Voice", lines=1, placeholder=initialname, value=initialname)
311
+ with gr.Column():
312
+ tokenizerlang = gr.Dropdown(tokenizer_language_list, label="Base Language Tokenizer", value=tokenizer_language_list[1])
313
+ with gr.Row():
314
+ clone_voice_button = gr.Button("Create Voice")
315
+ with gr.Row():
316
+ dummy = gr.Text(label="Progress")
317
+ npz_file = gr.File(label=".npz file")
318
+
319
  with gr.Tab("TTS"):
320
  with gr.Row():
321
  with gr.Column():
 
354
  with gr.Column():
355
  gr.Markdown("[Voice Prompt Library](https://suno-ai.notion.site/8b8e8749ed514b0cbf3f699013548683?v=bc67cff786b04b50b3ceb756fd05f68c)")
356
  speaker = gr.Dropdown(speakers_list, value=speakers_list[0], label="Voice")
357
+ speaker_custom = npz_file
358
+
359
  with gr.Column():
360
  text_temp = gr.Slider(0.1, 1.0, value=0.6, label="Generation Temperature", info="1.0 more diverse, 0.1 more conservative")
361
  waveform_temp = gr.Slider(0.1, 1.0, value=0.7, label="Waveform temperature", info="1.0 more diverse, 0.1 more conservative")
 
371
  with gr.Row():
372
  with gr.Column():
373
  tts_create_button = gr.Button("Generate")
374
+ tts_custom_button = gr.Button("Voice Cloning")
375
  with gr.Column():
376
  hidden_checkbox = gr.Checkbox(visible=False)
377
  button_stop_generation = gr.Button("Stop generation")
 
393
  with gr.Row():
394
  output_swap = gr.Audio(label="Generated Audio", type="filepath")
395
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
396
  with gr.Tab("Training Data Prepare"):
397
  gr.Markdown("This tab should be used to generate the training dataset. For Step 1 put some books into the inputtext folder in UTF-8 Text Format.")
398
  prepare_semantics_number = gr.Number(label="Number of semantics to create", precision=0, value=3079)
 
441
  convert_to_ssml_button.click(convert_text_to_ssml, inputs=[input_text, speaker],outputs=input_text)
442
  gen_click = tts_create_button.click(generate_text_to_speech, inputs=[input_text, speaker, text_temp, waveform_temp, eos_prob, quick_gen_checkbox, complete_settings, seedcomponent, batchcount],outputs=output_audio)
443
  button_stop_generation.click(fn=None, inputs=None, outputs=None, cancels=[gen_click])
444
+
445
+ tts_custom_button.click(generate_text_to_speech, inputs=[input_text, speaker_custom, text_temp, waveform_temp, eos_prob, quick_gen_checkbox, complete_settings, seedcomponent, batchcount],outputs=output_audio)
446
+
447
  # Javascript hack to display modal confirmation dialog
448
  js = "(x) => confirm('Are you sure? This will remove all files from output folder')"
449
  button_delete_files.click(None, None, hidden_checkbox, _js=js)