Amamrnaf commited on
Commit
5ca9cb4
·
1 Parent(s): bb14413
Files changed (2) hide show
  1. app.py +5 -2
  2. metaVoice.py +22 -22
app.py CHANGED
@@ -1,8 +1,10 @@
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
 
8
  def process_audio(input_text, speaker_audio, speaker_name, option_selected):
@@ -27,7 +29,8 @@ def process_audio(input_text, speaker_audio, speaker_name, option_selected):
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
 
 
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
+
7
+
8
  os.environ["COQUI_TOS_AGREED"] = "1"
9
 
10
  def process_audio(input_text, speaker_audio, speaker_name, option_selected):
 
29
  # Generate TTS audio using run_audio_generation_v1
30
  run_audio_generation_v1(input_text)
31
  elif option_selected =="metaVoice":
32
+ return f"The option is {option_selected }not implemented yet."
33
+ # run_audio_generation_v2(input_text)
34
  else:
35
  return f"The option is not implemented yet."
36
 
metaVoice.py CHANGED
@@ -1,30 +1,30 @@
1
- from fam.llm.fast_inference import TTS
2
- import string
3
- import soundfile as sf
4
 
5
- def remove_punctuation(sentence):
6
- translator = str.maketrans('', '', string.punctuation)
7
- sentence = sentence.translate(translator)
8
 
9
- # Remove line breaks
10
- sentence = sentence.replace('\n', ' ').replace('\r', '')
11
 
12
- return sentence
13
 
14
- def run_audio_generation_v2(new_text,accent='None'):
15
- tts = TTS()
16
- new_text = new_text.replace('\n', ' ').replace('\r', '')
17
- new_text_mod = remove_punctuation(new_text)
18
 
19
- new_text_split = new_text_mod.split()
20
- for word in new_text_split:
21
- if len(word)>=2 and word.isupper():
22
- new_text = new_text.replace(word, " ".join([*word]))
23
 
24
- wav_file = tts.synthesise(
25
- text=new_text,
26
- spk_ref_path="./tmp/audio/speaker_wav.wav" # you can use any speaker reference file (WAV, OGG, MP3, FLAC, etc.)
27
- )
28
- sf.write('audio/output.wav', wav_file, samplerate=22050)
29
 
30
 
 
1
+ # from fam.llm.fast_inference import TTS
2
+ # import string
3
+ # import soundfile as sf
4
 
5
+ # def remove_punctuation(sentence):
6
+ # translator = str.maketrans('', '', string.punctuation)
7
+ # sentence = sentence.translate(translator)
8
 
9
+ # # Remove line breaks
10
+ # sentence = sentence.replace('\n', ' ').replace('\r', '')
11
 
12
+ # return sentence
13
 
14
+ # def run_audio_generation_v2(new_text,accent='None'):
15
+ # tts = TTS()
16
+ # new_text = new_text.replace('\n', ' ').replace('\r', '')
17
+ # new_text_mod = remove_punctuation(new_text)
18
 
19
+ # new_text_split = new_text_mod.split()
20
+ # for word in new_text_split:
21
+ # if len(word)>=2 and word.isupper():
22
+ # new_text = new_text.replace(word, " ".join([*word]))
23
 
24
+ # wav_file = tts.synthesise(
25
+ # text=new_text,
26
+ # spk_ref_path="./tmp/audio/speaker_wav.wav" # you can use any speaker reference file (WAV, OGG, MP3, FLAC, etc.)
27
+ # )
28
+ # sf.write('audio/output.wav', wav_file, samplerate=22050)
29
 
30