Spaces:
Runtime error
Runtime error
Suparnpreet
commited on
Update texttospeech.py
Browse files- texttospeech.py +10 -1
texttospeech.py
CHANGED
@@ -1,12 +1,21 @@
|
|
1 |
import torch
|
2 |
from TTS.api import TTS
|
|
|
3 |
|
|
|
|
|
|
|
4 |
|
|
|
|
|
|
|
|
|
5 |
print(TTS().list_models())
|
6 |
|
7 |
# Init TTS
|
8 |
tts = TTS("tts_models/multilingual/multi-dataset/xtts_v2").to('cpu')
|
9 |
|
|
|
10 |
|
11 |
-
def speak(text,lang):
|
12 |
tts.tts_to_file(text=text, speaker_wav="speech.wav", language=lang, file_path="output.wav")
|
|
|
1 |
import torch
|
2 |
from TTS.api import TTS
|
3 |
+
from TTS.utils.manage import ModelManager
|
4 |
|
5 |
+
# Override the ask_tos method
|
6 |
+
def always_accept_tos(self, output_path):
|
7 |
+
return True
|
8 |
|
9 |
+
# Apply the override
|
10 |
+
ModelManager.ask_tos = always_accept_tos
|
11 |
+
|
12 |
+
# Proceed with the rest of your code
|
13 |
print(TTS().list_models())
|
14 |
|
15 |
# Init TTS
|
16 |
tts = TTS("tts_models/multilingual/multi-dataset/xtts_v2").to('cpu')
|
17 |
|
18 |
+
print(tts.languages)
|
19 |
|
20 |
+
def speak(text, lang):
|
21 |
tts.tts_to_file(text=text, speaker_wav="speech.wav", language=lang, file_path="output.wav")
|