VideoDubber / texttospeech.py
Suparnpreet's picture
Update texttospeech.py
942a97e verified
raw
history blame
266 Bytes
import torch
from TTS.api import TTS
print(TTS().list_models())
# Init TTS
tts = TTS("tts_models/multilingual/multi-dataset/xtts_v2").to('cpu')
def speak(text,lang):
tts.tts_to_file(text=text, speaker_wav="speech.wav", language=lang, file_path="output.wav")