File size: 518 Bytes
942a97e
 
e0277c8
942a97e
e0277c8
 
 
942a97e
e0277c8
 
 
 
942a97e
 
 
 
 
e0277c8
942a97e
e0277c8
942a97e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import torch
from TTS.api import TTS
from TTS.utils.manage import ModelManager

# Override the ask_tos method
def always_accept_tos(self, output_path):
    return True

# Apply the override
ModelManager.ask_tos = always_accept_tos

# Proceed with the rest of your code
print(TTS().list_models())

# Init TTS
tts = TTS("tts_models/multilingual/multi-dataset/xtts_v2").to('cpu')

print(tts.languages)

def speak(text, lang):
    tts.tts_to_file(text=text, speaker_wav="speech.wav", language=lang, file_path="output.wav")