Spaces:
Running
Running
drewThomasson
commited on
Commit
•
6ca77a8
1
Parent(s):
76d9165
Update app.py
Browse files
app.py
CHANGED
@@ -5,24 +5,64 @@ from outetts.v0_1.interface import InterfaceHF
|
|
5 |
interface = InterfaceHF("OuteAI/OuteTTS-0.1-350M")
|
6 |
|
7 |
def generate_tts(text, temperature, repetition_penalty, max_length):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
output = interface.generate(
|
9 |
text=text,
|
10 |
temperature=temperature,
|
11 |
repetition_penalty=repetition_penalty,
|
12 |
max_lenght=max_length
|
13 |
)
|
14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
|
16 |
-
# Gradio
|
17 |
-
|
18 |
-
fn=generate_tts,
|
19 |
-
inputs=[
|
20 |
-
gr.Textbox(label="Text Input", placeholder="Enter the text for TTS generation"),
|
21 |
-
gr.Slider(0.1, 1.0, value=0.1, step=0.01, label="Temperature"),
|
22 |
-
gr.Slider(0.5, 2.0, value=1.1, step=0.1, label="Repetition Penalty"),
|
23 |
-
gr.Slider(256, 4096, value=1024, step=256, label="Max Length")
|
24 |
-
],
|
25 |
-
outputs=gr.Audio(label="Generated Speech"),
|
26 |
-
title="OuteTTS - Text to Speech Interface",
|
27 |
-
description="Generate speech from text using the OuteTTS model."
|
28 |
-
).launch()
|
|
|
5 |
interface = InterfaceHF("OuteAI/OuteTTS-0.1-350M")
|
6 |
|
7 |
def generate_tts(text, temperature, repetition_penalty, max_length):
|
8 |
+
# Logging information to the terminal
|
9 |
+
print("Generating TTS with the following parameters:")
|
10 |
+
print(f"Text: {text}")
|
11 |
+
print(f"Temperature: {temperature}")
|
12 |
+
print(f"Repetition Penalty: {repetition_penalty}")
|
13 |
+
print(f"Max Length: {max_length}")
|
14 |
+
|
15 |
output = interface.generate(
|
16 |
text=text,
|
17 |
temperature=temperature,
|
18 |
repetition_penalty=repetition_penalty,
|
19 |
max_lenght=max_length
|
20 |
)
|
21 |
+
print("TTS generation complete. Output ready.")
|
22 |
+
return output # Gradio will handle the audio directly
|
23 |
+
|
24 |
+
# Gradio Blocks API for structured UI
|
25 |
+
with gr.Blocks() as demo:
|
26 |
+
gr.Markdown("# OuteTTS - Text to Speech Interface")
|
27 |
+
gr.Markdown("Generate speech from text using the OuteTTS model.")
|
28 |
+
|
29 |
+
with gr.Row():
|
30 |
+
text_input = gr.Textbox(
|
31 |
+
label="Text Input",
|
32 |
+
placeholder="Enter the text for TTS generation",
|
33 |
+
lines=3
|
34 |
+
)
|
35 |
+
|
36 |
+
temperature = gr.Slider(
|
37 |
+
minimum=0.1,
|
38 |
+
maximum=1.0,
|
39 |
+
value=0.1,
|
40 |
+
step=0.01,
|
41 |
+
label="Temperature"
|
42 |
+
)
|
43 |
+
repetition_penalty = gr.Slider(
|
44 |
+
minimum=0.5,
|
45 |
+
maximum=2.0,
|
46 |
+
value=1.1,
|
47 |
+
step=0.1,
|
48 |
+
label="Repetition Penalty"
|
49 |
+
)
|
50 |
+
max_length = gr.Slider(
|
51 |
+
minimum=256,
|
52 |
+
maximum=4096,
|
53 |
+
value=1024,
|
54 |
+
step=256,
|
55 |
+
label="Max Length"
|
56 |
+
)
|
57 |
+
|
58 |
+
output_audio = gr.Audio(label="Generated Speech", type="auto")
|
59 |
+
|
60 |
+
generate_button = gr.Button("Generate Speech")
|
61 |
+
generate_button.click(
|
62 |
+
fn=generate_tts,
|
63 |
+
inputs=[text_input, temperature, repetition_penalty, max_length],
|
64 |
+
outputs=output_audio
|
65 |
+
)
|
66 |
|
67 |
+
# Launch the Gradio demo
|
68 |
+
demo.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|