import gradio as gr from transformers import pipeline pipe = pipeline("text-to-speech", model="myshell-ai/MeloTTS-English") def text_to_speech(text): audio = pipe(text) return audio["audio"] title = "Text-to-Speech (MeloTTS)" description = "Provide input text, and the model will convert it into speech." interface = gr.Interface( fn=text_to_speech, inputs=gr.Textbox(label="Input Text", placeholder="Type something..."), outputs=gr.Audio(label="Generated Speech"), title=title, description=description, ) if __name__ == "__main__": interface.launch()