Usually3 commited on
Commit
2e483f7
·
1 Parent(s): 6c0e89e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -25
app.py CHANGED
@@ -12,20 +12,20 @@ def text_to_speech(text: str, speaker_wav, speaker_wav_file, language: str):
12
  speaker_wav = speaker_wav_file
13
  file_path = "output.wav"
14
  if language == "zh-CN":
15
- # if speaker_wav is not None:
16
- # zh_tts.tts_to_file(text, speaker_wav=speaker_wav, file_path=file_path)
17
- # else:
18
- zh_tts.tts_to_file(text, file_path=file_path)
19
  elif language == "de":
20
- # if speaker_wav is not None:
21
- # de_tts.tts_to_file(text, speaker_wav=speaker_wav, file_path=file_path)
22
- # else:
23
- de_tts.tts_to_file(text, file_path=file_path)
24
  elif language == "es":
25
- # if speaker_wav is not None:
26
- # es_tts.tts_to_file(text, speaker_wav=speaker_wav, file_path=file_path)
27
- # else:
28
- es_tts.tts_to_file(text, file_path=file_path)
29
  else:
30
  if speaker_wav is not None:
31
  tts.tts_to_file(text, speaker_wav=speaker_wav, language=language, file_path=file_path)
@@ -35,18 +35,6 @@ def text_to_speech(text: str, speaker_wav, speaker_wav_file, language: str):
35
 
36
 
37
 
38
- # inputs = [gr.Textbox(label="Input the text", value="", max_lines=3),
39
- # gr.Audio(label="Voice to clone", source="microphone", type="filepath"),
40
- # gr.Audio(label="Voice to clone", type="filepath"),
41
- # gr.Radio(label="Language", choices=["en", "zh-CN", "fr-fr", "pt-br", "de", "es"], value="en"),
42
- # gr.Text(intro_text, font_size=14)]
43
- # outputs = gr.Audio(label="Output")
44
-
45
- # demo = gr.Interface(fn=text_to_speech, inputs=inputs, outputs=outputs)
46
-
47
- # demo.launch()
48
-
49
-
50
  title = "Voice-Cloning-Demo"
51
 
52
  def toggle(choice):
@@ -89,4 +77,4 @@ with gr.Blocks() as demo:
89
  radio.change(toggle, radio, [audio_input_mic, audio_input_file])
90
  lan_input.change(handle_language_change, lan_input, [radio, audio_input_mic, audio_input_file])
91
 
92
- demo.launch(enable_queue=True)
 
12
  speaker_wav = speaker_wav_file
13
  file_path = "output.wav"
14
  if language == "zh-CN":
15
+ if speaker_wav is not None:
16
+ zh_tts.tts_to_file(text, speaker_wav=speaker_wav, file_path=file_path)
17
+ else:
18
+ zh_tts.tts_to_file(text, file_path=file_path)
19
  elif language == "de":
20
+ if speaker_wav is not None:
21
+ de_tts.tts_to_file(text, speaker_wav=speaker_wav, file_path=file_path)
22
+ else:
23
+ de_tts.tts_to_file(text, file_path=file_path)
24
  elif language == "es":
25
+ if speaker_wav is not None:
26
+ es_tts.tts_to_file(text, speaker_wav=speaker_wav, file_path=file_path)
27
+ else:
28
+ es_tts.tts_to_file(text, file_path=file_path)
29
  else:
30
  if speaker_wav is not None:
31
  tts.tts_to_file(text, speaker_wav=speaker_wav, language=language, file_path=file_path)
 
35
 
36
 
37
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  title = "Voice-Cloning-Demo"
39
 
40
  def toggle(choice):
 
77
  radio.change(toggle, radio, [audio_input_mic, audio_input_file])
78
  lan_input.change(handle_language_change, lan_input, [radio, audio_input_mic, audio_input_file])
79
 
80
+ demo.launch(enable_queue=True)