File size: 1,021 Bytes
e44094d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
26
27
28
29
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()