wedyanessam commited on
Commit
3a94722
·
verified ·
1 Parent(s): c79816c

Create TTS_X/tts.py

Browse files
Files changed (1) hide show
  1. 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