import torch
import sounddevice as sd
import time
sample_rate = 48000 # 48000
device = torch.device('cpu') # cpu или gpu
speaker = 'xenia'
model = torch.hub.load(repo_or_dir='snakers4/silero-models',
model='silero_tts',
language='ru',
speaker='v3_1_ru')[0]
model.to(device)
audio = model.apply_tts(text="приветмир",
speaker=speaker,
sample_rate=sample_rate)
sd.play(audio, sample_rate)
time.sleep(len(audio) / sample_rate)
sd.stop()