SUSE_audio_assistant/test/coqui_tts_out.py
Alex Lau (AvengerMoJo) 7ba9d8d3db
Just MVT demo for the concept of AI audio assistant.
Signed-off-by: Alex Lau (AvengerMoJo) <alau@suse.com>
2023-11-10 02:26:16 +08:00

26 lines
728 B
Python

import io
import tempfile
import pyaudio
from pydub import AudioSegment
import wave
from transformers import pipeline
from datasets import load_dataset
from audio_utils import AudioSplit
from faster_whisper import WhisperModel
import torch
from TTS.api import TTS
# Get device
device = "cuda" if torch.cuda.is_available() else "cpu"
# Init TTS
# tts = TTS("tts_models/multilingual/multi-dataset/xtts_v2").to(device)
tts = TTS("tts_models/en/blizzard2013/capacitron-t2-c150_v2").to(device)
# tts.tts_to_file(text="Hello, I am your SUSE ... assistant. What can I do for you today?", file_path="/tmp/out.wav")
tts.tts_to_file(text="Sorry, I don't get your question, please say that again please.", file_path="/tmp/out.wav")