Spaces:
Runtime error
Runtime error
import gradio as gr | |
from TTS.api import TTS | |
# Initialize the multilingual TTS model | |
tts = TTS(model_name="tts_models/multilingual/multi-dataset/your_tts", progress_bar=False, gpu=False) | |
def text_to_speech(text): | |
# Generate speech from text | |
audio_path = tts.tts_to_file(text=text, file_path="output.wav") | |
# Return the path to the audio file | |
return audio_path | |
# Create Gradio interface | |
interface = gr.Interface( | |
fn=text_to_speech, | |
inputs=gr.Textbox(lines=5, placeholder="Enter text here..."), | |
outputs=gr.Audio(type="filepath"), | |
title="AI-Powered Text-to-Speech Converter", | |
description="Convert text to speech using AI models.", | |
) | |
# Launch the interface | |
if __name__ == "__main__": | |
interface.launch() | |