VideoDubber / texttospeech.py
Suparnpreet's picture
Upload 7 files
2c1eba3 verified
raw
history blame
272 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):
tts.tts_to_file(text=text, speaker_wav="speech.wav", language="en", file_path="output.wav")