vctts / app.py
doevent's picture
Update app.py
b6b5871
raw
history blame
No virus
1.04 kB
import gradio as gr
import os
from TTS.api import TTS
import time
tts = TTS("tts_models/multilingual/multi-dataset/xtts_v1")
tts.to("cpu")
def audio_tts(prompt, language, speaker_wav):
# TTS with on the fly voice conversion
print(f"Language: {language}")
tts.tts_to_file(
text=prompt,
file_path="output.wav",
speaker_wav=speaker_wav,
language=language,
gpu=False,
)
return "ouptut.wav"
demo = gr.Interface(fn=audio_tts, inputs=[gr.Textbox(label="Input text TTS", value="Привет! Я Макс."),
gr.Dropdown(choices=["ru", "en", "es", "fa", "tr", "de", "ar", "pt", "hi"],
label="Language", value="rus"),
gr.Audio(source="upload", type="filepath", label="Input audio")],
outputs=gr.Audio(source="upload", type="filepath", label="Output audio"))
demo.queue(concurrency_count=1).launch(show_error=True)