Rupesx007 commited on
Commit
a22a061
·
verified ·
1 Parent(s): b840892

changed to tacatron2

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -41,12 +41,12 @@ def process_text(text):
41
  return '\n'.join(processed)
42
 
43
  def text_to_speech(text):
44
- """Convert text to speech using Hugging Face transformers."""
45
  try:
46
- tts_pipeline = pipeline("text-to-speech", model="espnet/kan-bayashi_ljspeech_vits", device=0 if torch.cuda.is_available() else -1)
47
  output = tts_pipeline(text)
48
 
49
- audio_array = np.array(output["array"])
50
  sample_rate = output["sampling_rate"]
51
 
52
  audio_file = "output.wav"
 
41
  return '\n'.join(processed)
42
 
43
  def text_to_speech(text):
44
+ """Convert text to speech using Hugging Face's SpeechBrain model."""
45
  try:
46
+ tts_pipeline = pipeline("text-to-speech", model="speechbrain/tts-tacotron2-ljspeech", device=0 if torch.cuda.is_available() else -1)
47
  output = tts_pipeline(text)
48
 
49
+ audio_array = np.array(output["audio"])
50
  sample_rate = output["sampling_rate"]
51
 
52
  audio_file = "output.wav"