Spaces:
Runtime error
Runtime error
Create TTS_X/tts.py
Browse files- TTS_X/tts.py +14 -0
TTS_X/tts.py
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from TTS.api import TTS
|
2 |
+
|
3 |
+
# تحميل موديل XTTS
|
4 |
+
tts = TTS("tts_models/multilingual/multi-dataset/xtts_v2", gpu=True)
|
5 |
+
|
6 |
+
def generate_voice(text, speaker_wav_path, language="ar"):
|
7 |
+
output_path = "output.wav"
|
8 |
+
tts.tts_to_file(
|
9 |
+
text=text,
|
10 |
+
file_path=output_path,
|
11 |
+
speaker_wav=speaker_wav_path,
|
12 |
+
language=language
|
13 |
+
)
|
14 |
+
return output_path
|