Spaces:
Runtime error
Runtime error
File size: 741 Bytes
a03b7f2 7184c47 a03b7f2 3e117f4 a03b7f2 6976c11 3e117f4 a03b7f2 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
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()
|