KevinGeng commited on
Commit
1b3fb80
1 Parent(s): fba95bd

apply open version / test version

Browse files
Files changed (1) hide show
  1. app.py +134 -90
app.py CHANGED
@@ -363,103 +363,147 @@ with gr.Blocks(
363
  analytics_enabled=False,
364
  css=".gradio-container {background-color: #78BD91}",
365
  ) as demo:
366
- with gr.Column(elem_id="Column"):
367
- input_format = gr.Radio(
368
- choices=["microphone", "upload"], label="Choose your input format", elem_id="input_format"
369
- )
370
- input_audio = gr.Audio(
371
- source="microphone",
372
- type="filepath",
373
- label="Input Audio",
374
- interactive=True,
375
- visible=False,
376
- elem_id="input_audio"
377
- )
378
- input_format.change(
379
- fn=change_audiobox, inputs=input_format, outputs=input_audio
380
- )
381
-
382
- speaker_option = gr.Radio(choices=spk_names, value="Male1", label="Choose your voice profile")
383
- spk_icon = gr.Image(value="speaker_icons/male1.png",
384
- type="filepath",
385
- image_mode="RGB",
386
- source="upload",
387
- shape=[50, 50],
388
- interactive=True,
389
- visible=True)
390
- speaker_option.change(
391
- fn=show_icon, inputs=speaker_option, outputs=spk_icon
392
- )
393
- with gr.Column():
394
- with gr.Row():
395
- b2 = gr.Button("Convert")
396
-
397
- output_audio = gr.Audio(
398
- source="upload", file="filepath", label="Converted Audio", interactive=False
399
  )
400
-
401
- b2.click(
402
- ASRTTS_clean,
403
- inputs=[input_audio, speaker_option],
404
- outputs=output_audio,
405
- api_name="convert"
 
406
  )
407
- with gr.Row():
408
- # Fastspeech2 + PWG [under construction]
409
- b_ft2 = gr.Button("Convert_fastspeech2")
410
-
411
- output_audio_ft2= gr.Audio(
412
- source="upload", file="filepath", label="Converted Audio", interactive=False
413
  )
414
-
415
- b_ft2.click(
416
- ft2_ASRTTS_clean,
417
- inputs=[input_audio, speaker_option],
418
- outputs=output_audio_ft2,
419
- api_name="convert_ft2"
 
 
 
 
 
420
  )
421
- with gr.Row():
422
- # Fastspeech2 + hifigan [under construction]
423
- b_ft2_hifi = gr.Button("Convert_fastspeech2+HifiGAN")
424
-
425
- output_audio_ft2_hifi= gr.Audio(
426
- source="upload", file="filepath", label="Converted Audio", interactive=False
 
 
 
 
 
 
 
 
 
 
 
 
 
427
  )
428
-
429
- b_ft2_hifi.click(
430
- ft2_ASRTTS_clean_hifi,
431
- inputs=[input_audio, speaker_option],
432
- outputs=output_audio_ft2_hifi,
433
- api_name="convert_ft2_hifi"
 
 
 
 
434
  )
435
- with gr.Row():
436
- # transformer [TODO]
437
- b_transformer = gr.Button("Convert_transformer")
438
 
439
- output_audio_transformer= gr.Audio(
440
- source="upload", file="filepath", label="Converted Audio", interactive=False
 
 
 
 
 
 
 
 
441
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
442
 
443
- b_transformer.click(
444
- transformer_ASRTTS_clean,
445
- inputs=[input_audio, speaker_option],
446
- outputs=output_audio_transformer,
447
- api_name="convert_trans"
448
- )
449
 
450
- # google tts [TODO]
451
- # b_google = gr.Button("Convert_googleTTS")
452
-
453
- # output_audio_google= gr.Audio(
454
- # source="upload", file="filepath", label="Converted Audio", interactive=False
455
- # )
456
-
457
- # b_google.click(
458
- # google_ASRTTS_clean,
459
- # inputs=[input_audio, speaker_option],
460
- # outputs=output_audio_google,
461
- # api_name="convert"
462
- # )
463
-
464
-
465
- demo.launch(share=True)
 
363
  analytics_enabled=False,
364
  css=".gradio-container {background-color: #78BD91}",
365
  ) as demo:
366
+ # Open Version
367
+ with gr.Tab("Open Version"):
368
+ with gr.Column(elem_id="Column"):
369
+ input_format = gr.Radio(
370
+ choices=["microphone", "upload"], label="Choose your input format", elem_id="input_format"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
371
  )
372
+ input_audio = gr.Audio(
373
+ source="microphone",
374
+ type="filepath",
375
+ label="Input Audio",
376
+ interactive=True,
377
+ visible=False,
378
+ elem_id="input_audio"
379
  )
380
+ input_format.change(
381
+ fn=change_audiobox, inputs=input_format, outputs=input_audio
 
 
 
 
382
  )
383
+
384
+ speaker_option = gr.Radio(choices=spk_names, value="Male1", label="Choose your voice profile")
385
+ spk_icon = gr.Image(value="speaker_icons/male1.png",
386
+ type="filepath",
387
+ image_mode="RGB",
388
+ source="upload",
389
+ shape=[50, 50],
390
+ interactive=True,
391
+ visible=True)
392
+ speaker_option.change(
393
+ fn=show_icon, inputs=speaker_option, outputs=spk_icon
394
  )
395
+
396
+ b = gr.Button("Convert")
397
+
398
+ output_audio = gr.Audio(
399
+ source="upload", file="filepath", label="Converted Audio", interactive=False
400
+ )
401
+
402
+ b.click(
403
+ ASRTTS_clean,
404
+ inputs=[input_audio, speaker_option],
405
+ outputs=output_audio,
406
+ api_name="convert"
407
+ )
408
+
409
+ # Tab selection:
410
+ with gr.Tab("Test Version: Multi TTS model"):
411
+ with gr.Column(elem_id="Column"):
412
+ input_format = gr.Radio(
413
+ choices=["microphone", "upload"], label="Choose your input format", elem_id="input_format"
414
  )
415
+ input_audio = gr.Audio(
416
+ source="microphone",
417
+ type="filepath",
418
+ label="Input Audio",
419
+ interactive=True,
420
+ visible=False,
421
+ elem_id="input_audio"
422
+ )
423
+ input_format.change(
424
+ fn=change_audiobox, inputs=input_format, outputs=input_audio
425
  )
 
 
 
426
 
427
+ speaker_option = gr.Radio(choices=spk_names, value="Male1", label="Choose your voice profile")
428
+ spk_icon = gr.Image(value="speaker_icons/male1.png",
429
+ type="filepath",
430
+ image_mode="RGB",
431
+ source="upload",
432
+ shape=[50, 50],
433
+ interactive=True,
434
+ visible=True)
435
+ speaker_option.change(
436
+ fn=show_icon, inputs=speaker_option, outputs=spk_icon
437
  )
438
+ with gr.Column():
439
+ with gr.Row():
440
+ b2 = gr.Button("Convert")
441
+
442
+ output_audio = gr.Audio(
443
+ source="upload", file="filepath", label="Converted Audio", interactive=False
444
+ )
445
+
446
+ b2.click(
447
+ ASRTTS_clean,
448
+ inputs=[input_audio, speaker_option],
449
+ outputs=output_audio,
450
+ api_name="convert_"
451
+ )
452
+ with gr.Row():
453
+ # Fastspeech2 + PWG [under construction]
454
+ b_ft2 = gr.Button("Convert_fastspeech2")
455
+
456
+ output_audio_ft2= gr.Audio(
457
+ source="upload", file="filepath", label="Converted Audio", interactive=False
458
+ )
459
+
460
+ b_ft2.click(
461
+ ft2_ASRTTS_clean,
462
+ inputs=[input_audio, speaker_option],
463
+ outputs=output_audio_ft2,
464
+ api_name="convert_ft2"
465
+ )
466
+ with gr.Row():
467
+ # Fastspeech2 + hifigan [under construction]
468
+ b_ft2_hifi = gr.Button("Convert_fastspeech2+HifiGAN")
469
+
470
+ output_audio_ft2_hifi= gr.Audio(
471
+ source="upload", file="filepath", label="Converted Audio", interactive=False
472
+ )
473
+
474
+ b_ft2_hifi.click(
475
+ ft2_ASRTTS_clean_hifi,
476
+ inputs=[input_audio, speaker_option],
477
+ outputs=output_audio_ft2_hifi,
478
+ api_name="convert_ft2_hifi"
479
+ )
480
+ with gr.Row():
481
+ # transformer [TODO]
482
+ b_transformer = gr.Button("Convert_transformer")
483
+
484
+ output_audio_transformer= gr.Audio(
485
+ source="upload", file="filepath", label="Converted Audio", interactive=False
486
+ )
487
+
488
+ b_transformer.click(
489
+ transformer_ASRTTS_clean,
490
+ inputs=[input_audio, speaker_option],
491
+ outputs=output_audio_transformer,
492
+ api_name="convert_trans"
493
+ )
494
 
495
+ # google tts [TODO]
496
+ # b_google = gr.Button("Convert_googleTTS")
 
 
 
 
497
 
498
+ # output_audio_google= gr.Audio(
499
+ # source="upload", file="filepath", label="Converted Audio", interactive=False
500
+ # )
501
+
502
+ # b_google.click(
503
+ # google_ASRTTS_clean,
504
+ # inputs=[input_audio, speaker_option],
505
+ # outputs=output_audio_google,
506
+ # api_name="convert"
507
+ # )
508
+
509
+ demo.launch(share=False)