Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -1,13 +1,19 @@
|
|
1 |
import os
|
2 |
import gradio as gr
|
3 |
import outetts
|
4 |
-
from outetts.version.v2.interface import DEFAULT_SPEAKERS # Fixed the import syntax
|
5 |
import torch
|
6 |
import spaces
|
7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
def get_available_speakers():
|
9 |
-
|
10 |
-
return speakers
|
11 |
|
12 |
@spaces.GPU
|
13 |
def generate_tts(text, temperature, repetition_penalty, speaker_selection, reference_audio):
|
@@ -72,6 +78,19 @@ custom_css = """
|
|
72 |
border-radius: 15px;
|
73 |
padding: 1.5rem;
|
74 |
margin: 1rem 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
}
|
76 |
"""
|
77 |
|
@@ -117,19 +136,21 @@ with gr.Blocks(css=custom_css) as demo:
|
|
117 |
|
118 |
submit_button = gr.Button(
|
119 |
"Generate Speech",
|
120 |
-
variant="primary"
|
|
|
121 |
)
|
122 |
|
123 |
with gr.Column(scale=1):
|
124 |
-
# Output section
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
|
|
133 |
|
134 |
submit_button.click(
|
135 |
fn=generate_tts,
|
|
|
1 |
import os
|
2 |
import gradio as gr
|
3 |
import outetts
|
|
|
4 |
import torch
|
5 |
import spaces
|
6 |
|
7 |
+
# Define available speakers
|
8 |
+
AVAILABLE_SPEAKERS = [
|
9 |
+
"en_male_1", "en_male_2", "en_female_1", "en_female_2",
|
10 |
+
"zh_male_1", "zh_male_2", "zh_female_1", "zh_female_2",
|
11 |
+
"jp_male_1", "jp_male_2", "jp_female_1", "jp_female_2",
|
12 |
+
"kr_male_1", "kr_male_2", "kr_female_1", "kr_female_2"
|
13 |
+
]
|
14 |
+
|
15 |
def get_available_speakers():
|
16 |
+
return AVAILABLE_SPEAKERS
|
|
|
17 |
|
18 |
@spaces.GPU
|
19 |
def generate_tts(text, temperature, repetition_penalty, speaker_selection, reference_audio):
|
|
|
78 |
border-radius: 15px;
|
79 |
padding: 1.5rem;
|
80 |
margin: 1rem 0;
|
81 |
+
box-shadow: 0 8px 16px rgba(0,0,0,0.1);
|
82 |
+
}
|
83 |
+
.generate-button {
|
84 |
+
background: linear-gradient(45deg, #2196F3, #00BCD4);
|
85 |
+
color: white;
|
86 |
+
border: none;
|
87 |
+
padding: 1rem 2rem;
|
88 |
+
border-radius: 8px;
|
89 |
+
cursor: pointer;
|
90 |
+
transition: transform 0.2s;
|
91 |
+
}
|
92 |
+
.generate-button:hover {
|
93 |
+
transform: translateY(-2px);
|
94 |
}
|
95 |
"""
|
96 |
|
|
|
136 |
|
137 |
submit_button = gr.Button(
|
138 |
"Generate Speech",
|
139 |
+
variant="primary",
|
140 |
+
elem_classes="generate-button"
|
141 |
)
|
142 |
|
143 |
with gr.Column(scale=1):
|
144 |
+
# Output section with 3D effect
|
145 |
+
with gr.Group(elem_classes="control-panel"):
|
146 |
+
audio_output = gr.Audio(
|
147 |
+
label="Generated Audio",
|
148 |
+
type="filepath"
|
149 |
+
)
|
150 |
+
error_box = gr.Textbox(
|
151 |
+
label="Status",
|
152 |
+
visible=False
|
153 |
+
)
|
154 |
|
155 |
submit_button.click(
|
156 |
fn=generate_tts,
|