Spaces:
Runtime error
Runtime error
import os | |
import gradio as gr | |
from TTS.api import TTS | |
os.environ["COQUI_TOS_AGREED"] = "1" | |
tts = TTS("tts_models/multilingual/multi-dataset/xtts_v2", gpu=False) | |
def process_inputs(audio, text): | |
# Generate speech by cloning a voice using default settings | |
tts.tts_to_file( | |
text=text, | |
file_path="output.wav", | |
speaker_wav=audio, | |
language="en", | |
) | |
return "output.wav" | |
iface = gr.Interface( | |
fn=process_inputs, | |
inputs=[ | |
gr.Audio(type="filepath", label="Sample Voice (> 6 sec)"), | |
gr.Textbox(label="Text Input"), | |
], | |
outputs=[ | |
gr.Audio(type="filepath", label="Text to Speech"), | |
], | |
title="Audio and Text Processing App", | |
description="Enter audio and text inputs, and get processed audio and text-to-speech outputs.", | |
) | |
iface.launch(debug=True) | |