Spaces:
Running
on
T4
Running
on
T4
Update app.py
Browse files
app.py
CHANGED
@@ -86,6 +86,24 @@ def text_to_speech(text, formula):
|
|
86 |
|
87 |
|
88 |
custom_css = """
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
.container-wrap {
|
90 |
display: flex !important;
|
91 |
gap: 5px !important;
|
@@ -93,13 +111,11 @@ custom_css = """
|
|
93 |
margin: 0 auto !important;
|
94 |
max-width: 1400px !important; /* Increased max-width */
|
95 |
}
|
96 |
-
|
97 |
.vert-group {
|
98 |
min-width: 100px !important; /* Increased from 80px */
|
99 |
width: 120px !important; /* Increased from 90px */
|
100 |
flex: 0 0 auto !important;
|
101 |
}
|
102 |
-
|
103 |
.vert-group label {
|
104 |
white-space: nowrap !important;
|
105 |
overflow: visible !important;
|
@@ -114,13 +130,16 @@ custom_css = """
|
|
114 |
margin-bottom: 5px !important;
|
115 |
padding: 0 5px !important; /* Added padding */
|
116 |
}
|
117 |
-
|
118 |
.vert-group .wrap label {
|
119 |
text-align: center !important;
|
120 |
width: 100% !important;
|
121 |
display: block !important;
|
122 |
}
|
123 |
-
|
|
|
|
|
|
|
|
|
124 |
.slider_input_container {
|
125 |
height: 200px !important;
|
126 |
position: relative !important;
|
@@ -128,7 +147,6 @@ custom_css = """
|
|
128 |
margin: 0 auto !important;
|
129 |
overflow: hidden !important;
|
130 |
}
|
131 |
-
|
132 |
.slider_input_container input[type="range"] {
|
133 |
position: absolute !important;
|
134 |
width: 200px !important;
|
@@ -136,52 +154,62 @@ custom_css = """
|
|
136 |
top: 100px !important;
|
137 |
transform: rotate(90deg) !important;
|
138 |
}
|
139 |
-
|
140 |
.min_value {
|
141 |
position: absolute !important;
|
142 |
bottom: 0 !important;
|
143 |
left: 10px !important;
|
144 |
}
|
145 |
-
|
146 |
.max_value {
|
147 |
position: absolute !important;
|
148 |
top: 0 !important;
|
149 |
left: 10px !important;
|
150 |
}
|
151 |
-
|
152 |
.tab-like-container {
|
153 |
transform: scale(0.8) !important;
|
154 |
}
|
155 |
-
|
156 |
.gradio-row, .gradio-column {
|
157 |
background: none !important;
|
158 |
border: none !important;
|
159 |
min-width: unset !important;
|
160 |
}
|
161 |
-
|
162 |
.heading {
|
163 |
text-align: center !important;
|
164 |
margin-bottom: 1rem !important;
|
165 |
}
|
166 |
-
|
167 |
.description {
|
168 |
text-align: center !important;
|
169 |
margin-bottom: 2rem !important;
|
170 |
color: rgba(255, 255, 255, 0.7) !important;
|
171 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
172 |
"""
|
173 |
|
174 |
with gr.Blocks(css=custom_css, theme="ocean") as demo:
|
175 |
gr.Markdown(
|
176 |
"""
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
"""
|
183 |
)
|
184 |
-
|
185 |
with gr.Row(variant="default", equal_height=True, elem_classes="container-wrap"):
|
186 |
checkboxes = []
|
187 |
sliders = []
|
@@ -224,7 +252,7 @@ with gr.Blocks(css=custom_css, theme="ocean") as demo:
|
|
224 |
lines=2,
|
225 |
scale=4
|
226 |
)
|
227 |
-
button_tts = gr.Button("🎙️ Generate Voice", scale=2, min_width=100)
|
228 |
|
229 |
# Generate speech from the selected custom voice
|
230 |
with gr.Row(equal_height=True):
|
|
|
86 |
|
87 |
|
88 |
custom_css = """
|
89 |
+
/* Main title */
|
90 |
+
.heading {
|
91 |
+
color: rgb(76, 175, 147) !important;
|
92 |
+
font-size: 2em !important;
|
93 |
+
font-weight: 600 !important;
|
94 |
+
text-align: center !important;
|
95 |
+
margin: 20px 0 10px 0 !important;
|
96 |
+
}
|
97 |
+
|
98 |
+
/* Description text */
|
99 |
+
.description {
|
100 |
+
color: rgba(76, 175, 147, 0.7) !important;
|
101 |
+
text-align: center !important;
|
102 |
+
max-width: 800px !important;
|
103 |
+
margin: 0 auto 30px auto !important;
|
104 |
+
font-size: 0.9em !important;
|
105 |
+
line-height: 1.6 !important;
|
106 |
+
}
|
107 |
.container-wrap {
|
108 |
display: flex !important;
|
109 |
gap: 5px !important;
|
|
|
111 |
margin: 0 auto !important;
|
112 |
max-width: 1400px !important; /* Increased max-width */
|
113 |
}
|
|
|
114 |
.vert-group {
|
115 |
min-width: 100px !important; /* Increased from 80px */
|
116 |
width: 120px !important; /* Increased from 90px */
|
117 |
flex: 0 0 auto !important;
|
118 |
}
|
|
|
119 |
.vert-group label {
|
120 |
white-space: nowrap !important;
|
121 |
overflow: visible !important;
|
|
|
130 |
margin-bottom: 5px !important;
|
131 |
padding: 0 5px !important; /* Added padding */
|
132 |
}
|
|
|
133 |
.vert-group .wrap label {
|
134 |
text-align: center !important;
|
135 |
width: 100% !important;
|
136 |
display: block !important;
|
137 |
}
|
138 |
+
/* Hover effect */
|
139 |
+
.vert-group:hover {
|
140 |
+
transform: translateY(-5px) !important;
|
141 |
+
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2) !important;
|
142 |
+
}
|
143 |
.slider_input_container {
|
144 |
height: 200px !important;
|
145 |
position: relative !important;
|
|
|
147 |
margin: 0 auto !important;
|
148 |
overflow: hidden !important;
|
149 |
}
|
|
|
150 |
.slider_input_container input[type="range"] {
|
151 |
position: absolute !important;
|
152 |
width: 200px !important;
|
|
|
154 |
top: 100px !important;
|
155 |
transform: rotate(90deg) !important;
|
156 |
}
|
|
|
157 |
.min_value {
|
158 |
position: absolute !important;
|
159 |
bottom: 0 !important;
|
160 |
left: 10px !important;
|
161 |
}
|
|
|
162 |
.max_value {
|
163 |
position: absolute !important;
|
164 |
top: 0 !important;
|
165 |
left: 10px !important;
|
166 |
}
|
|
|
167 |
.tab-like-container {
|
168 |
transform: scale(0.8) !important;
|
169 |
}
|
|
|
170 |
.gradio-row, .gradio-column {
|
171 |
background: none !important;
|
172 |
border: none !important;
|
173 |
min-width: unset !important;
|
174 |
}
|
|
|
175 |
.heading {
|
176 |
text-align: center !important;
|
177 |
margin-bottom: 1rem !important;
|
178 |
}
|
|
|
179 |
.description {
|
180 |
text-align: center !important;
|
181 |
margin-bottom: 2rem !important;
|
182 |
color: rgba(255, 255, 255, 0.7) !important;
|
183 |
}
|
184 |
+
|
185 |
+
/* Generate button */
|
186 |
+
#generate-btn {
|
187 |
+
background: linear-gradient(90deg, rgb(76, 175, 147), rgb(76, 147, 175)) !important;
|
188 |
+
border: none !important;
|
189 |
+
border-radius: 8px !important;
|
190 |
+
padding: 12px 24px !important;
|
191 |
+
color: white !important;
|
192 |
+
font-weight: 600 !important;
|
193 |
+
transition: transform 0.2s, box-shadow 0.2s !important;
|
194 |
+
}
|
195 |
+
|
196 |
+
#generate-btn:hover {
|
197 |
+
transform: translateY(-2px) !important;
|
198 |
+
box-shadow: 0 5px 15px rgba(76, 175, 147, 0.3) !important;
|
199 |
+
}
|
200 |
"""
|
201 |
|
202 |
with gr.Blocks(css=custom_css, theme="ocean") as demo:
|
203 |
gr.Markdown(
|
204 |
"""
|
205 |
+
<div class="heading">🎙️ AI Voice Mixer Studio - Kokoro TTS</div>
|
206 |
+
<div class="description">
|
207 |
+
<b>Mix and match different voices to create your perfect text-to-speech voice.</b><br>Each slider represents a unique voice with distinct
|
208 |
+
characteristics. This app lets you combine multiple voices with different weights to create custom voice combinations. Select voices using checkboxes and adjust their weights using the sliders below!
|
209 |
+
</div>
|
210 |
"""
|
211 |
)
|
212 |
+
|
213 |
with gr.Row(variant="default", equal_height=True, elem_classes="container-wrap"):
|
214 |
checkboxes = []
|
215 |
sliders = []
|
|
|
252 |
lines=2,
|
253 |
scale=4
|
254 |
)
|
255 |
+
button_tts = gr.Button("🎙️ Generate Voice", scale=2, min_width=100, elem_id="generate-btn")
|
256 |
|
257 |
# Generate speech from the selected custom voice
|
258 |
with gr.Row(equal_height=True):
|