26 lines
728 B
Python
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")
|
|
|