import gradio as gr from outetts.v0_1.interface import InterfaceHF # Initialize the OuteTTS interface interface = InterfaceHF("OuteAI/OuteTTS-0.1-350M") def generate_tts(text, temperature, repetition_penalty, max_length): output = interface.generate( text=text, temperature=temperature, repetition_penalty=repetition_penalty, max_lenght=max_length ) return output # Gradio will play the audio directly # Gradio interface components gr.Interface( fn=generate_tts, inputs=[ gr.Textbox(label="Text Input", placeholder="Enter the text for TTS generation"), gr.Slider(0.1, 1.0, value=0.1, step=0.01, label="Temperature"), gr.Slider(0.5, 2.0, value=1.1, step=0.1, label="Repetition Penalty"), gr.Slider(256, 4096, value=1024, step=256, label="Max Length") ], outputs=gr.Audio(label="Generated Speech"), title="OuteTTS - Text to Speech Interface", description="Generate speech from text using the OuteTTS model." ).launch()