Amamrnaf commited on
Commit
bb14413
·
1 Parent(s): 5fc4f08
Files changed (2) hide show
  1. app.py +5 -2
  2. coqui_tts.py +4 -1
app.py CHANGED
@@ -1,6 +1,7 @@
1
  import gradio as gr
2
  import os
3
  from coqui_tts import run_audio_generation_v1
 
4
  import shutil
5
  os.environ["COQUI_TOS_AGREED"] = "1"
6
 
@@ -25,8 +26,10 @@ def process_audio(input_text, speaker_audio, speaker_name, option_selected):
25
  if option_selected == "Xtts_v2":
26
  # Generate TTS audio using run_audio_generation_v1
27
  run_audio_generation_v1(input_text)
 
 
28
  else:
29
- return f"The option '{option_selected}' is not implemented yet."
30
 
31
  # Save the output audio under the speaker's name
32
  speaker_output_path = f"audio/{speaker_name}.wav"
@@ -48,7 +51,7 @@ with gr.Blocks() as demo:
48
  speaker_audio = gr.Audio(label="Speaker Audio (to be cloned)", type='filepath', format='wav')
49
  speaker_name = gr.Textbox(label="Speaker Name", placeholder="Enter the speaker's name.")
50
 
51
- option_selected = gr.Dropdown(choices=["Xtts_v2", "metaVoice(not working at the moment)", "more"], label="Select an Option")
52
 
53
  submit_btn = gr.Button("Submit")
54
 
 
1
  import gradio as gr
2
  import os
3
  from coqui_tts import run_audio_generation_v1
4
+ from metaVoice import run_audio_generation_v2
5
  import shutil
6
  os.environ["COQUI_TOS_AGREED"] = "1"
7
 
 
26
  if option_selected == "Xtts_v2":
27
  # Generate TTS audio using run_audio_generation_v1
28
  run_audio_generation_v1(input_text)
29
+ elif option_selected =="metaVoice":
30
+ run_audio_generation_v2(input_text)
31
  else:
32
+ return f"The option is not implemented yet."
33
 
34
  # Save the output audio under the speaker's name
35
  speaker_output_path = f"audio/{speaker_name}.wav"
 
51
  speaker_audio = gr.Audio(label="Speaker Audio (to be cloned)", type='filepath', format='wav')
52
  speaker_name = gr.Textbox(label="Speaker Name", placeholder="Enter the speaker's name.")
53
 
54
+ option_selected = gr.Dropdown(choices=["Xtts_v2", "metaVoice", "more"], label="Select an Option")
55
 
56
  submit_btn = gr.Button("Submit")
57
 
coqui_tts.py CHANGED
@@ -32,7 +32,10 @@ def run_audio_generation_v1(new_text,accent='None'):
32
  for word in new_text_split:
33
  if len(word)>=2 and word.isupper():
34
  new_text = new_text.replace(word, " ".join([*word]))
35
-
 
 
 
36
  gpu = True if torch.cuda.is_available() else False
37
  tts = TTS("tts_models/multilingual/multi-dataset/xtts_v2", gpu=gpu) # gpu should be true when server (cuda)
38
  # if not gpu:
 
32
  for word in new_text_split:
33
  if len(word)>=2 and word.isupper():
34
  new_text = new_text.replace(word, " ".join([*word]))
35
+
36
+ models = TTS().list_models()
37
+ with open('models.txt', 'w') as f:
38
+ f.writelines(f"{model}\n" for model in models)
39
  gpu = True if torch.cuda.is_available() else False
40
  tts = TTS("tts_models/multilingual/multi-dataset/xtts_v2", gpu=gpu) # gpu should be true when server (cuda)
41
  # if not gpu: