Update AudioGeneration.py
Browse files- AudioGeneration.py +6 -5
AudioGeneration.py
CHANGED
|
@@ -1,9 +1,10 @@
|
|
| 1 |
from TTS.api import TTS
|
|
|
|
| 2 |
|
| 3 |
-
#
|
| 4 |
-
|
| 5 |
|
| 6 |
-
def generate_audio(text
|
| 7 |
-
output_path =
|
| 8 |
-
|
| 9 |
return output_path
|
|
|
|
| 1 |
from TTS.api import TTS
|
| 2 |
+
import os
|
| 3 |
|
| 4 |
+
# Initialize the TTS model (use a lightweight but high-quality model)
|
| 5 |
+
tts = TTS(model_name="tts_models/en/ljspeech/tacotron2-DDC", progress_bar=False, gpu=False)
|
| 6 |
|
| 7 |
+
def generate_audio(text):
|
| 8 |
+
output_path = "output.wav"
|
| 9 |
+
tts.tts_to_file(text=text, file_path=output_path)
|
| 10 |
return output_path
|