Commit ·
ac3f875
1
Parent(s): a0e95cb
Minor UI upgrades
Browse files
app.py
CHANGED
|
@@ -164,11 +164,10 @@ def generate_speech(language, gender, text, temperature, top_p, repetition_penal
|
|
| 164 |
return (SR, audio)
|
| 165 |
|
| 166 |
# --------------------------
|
| 167 |
-
# Randomize
|
| 168 |
# --------------------------
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
"""Select a random example and generate speech"""
|
| 172 |
example = random.choice(EXAMPLES_DATA)
|
| 173 |
|
| 174 |
# Map simple language name to display format
|
|
@@ -176,11 +175,8 @@ def randomize_and_generate(temperature, top_p, repetition_penalty, max_new_token
|
|
| 176 |
gender = example["gender"]
|
| 177 |
text = example["text"]
|
| 178 |
|
| 179 |
-
#
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
# Return values to populate UI fields + audio
|
| 183 |
-
return lang_display, gender, text, audio
|
| 184 |
|
| 185 |
# --------------------------
|
| 186 |
# UI
|
|
@@ -198,9 +194,11 @@ custom_theme = gr.themes.Soft(
|
|
| 198 |
|
| 199 |
with gr.Blocks(title="Svara Multilingual TTS", theme=custom_theme, css=".note{opacity:.85;font-size:.9em}") as demo:
|
| 200 |
gr.Markdown("""
|
| 201 |
-
#
|
| 202 |
|
| 203 |
*An open multilingual TTS model for expressive, human-like speech across India's languages.*
|
|
|
|
|
|
|
| 204 |
""")
|
| 205 |
|
| 206 |
with gr.Row():
|
|
@@ -226,9 +224,11 @@ with gr.Blocks(title="Svara Multilingual TTS", theme=custom_theme, css=".note{op
|
|
| 226 |
)
|
| 227 |
|
| 228 |
with gr.Row():
|
| 229 |
-
randomize_btn = gr.Button("🎲 Randomize", variant="secondary",
|
| 230 |
-
|
| 231 |
-
|
|
|
|
|
|
|
| 232 |
|
| 233 |
with gr.Accordion("Advanced Settings", open=False):
|
| 234 |
temperature = gr.Slider(
|
|
@@ -275,9 +275,9 @@ with gr.Blocks(title="Svara Multilingual TTS", theme=custom_theme, css=".note{op
|
|
| 275 |
)
|
| 276 |
|
| 277 |
randomize_btn.click(
|
| 278 |
-
fn=
|
| 279 |
-
inputs=[
|
| 280 |
-
outputs=[lang, gender, text_input
|
| 281 |
)
|
| 282 |
|
| 283 |
def _clear():
|
|
|
|
| 164 |
return (SR, audio)
|
| 165 |
|
| 166 |
# --------------------------
|
| 167 |
+
# Randomize
|
| 168 |
# --------------------------
|
| 169 |
+
def randomize():
|
| 170 |
+
"""Select a random example and populate the fields"""
|
|
|
|
| 171 |
example = random.choice(EXAMPLES_DATA)
|
| 172 |
|
| 173 |
# Map simple language name to display format
|
|
|
|
| 175 |
gender = example["gender"]
|
| 176 |
text = example["text"]
|
| 177 |
|
| 178 |
+
# Return values to populate UI fields only
|
| 179 |
+
return lang_display, gender, text
|
|
|
|
|
|
|
|
|
|
| 180 |
|
| 181 |
# --------------------------
|
| 182 |
# UI
|
|
|
|
| 194 |
|
| 195 |
with gr.Blocks(title="Svara Multilingual TTS", theme=custom_theme, css=".note{opacity:.85;font-size:.9em}") as demo:
|
| 196 |
gr.Markdown("""
|
| 197 |
+
# svara-tts
|
| 198 |
|
| 199 |
*An open multilingual TTS model for expressive, human-like speech across India's languages.*
|
| 200 |
+
|
| 201 |
+
Visit [svara-tts](https://huggingface.co/kenpath/svara-tts-v1) for more details.
|
| 202 |
""")
|
| 203 |
|
| 204 |
with gr.Row():
|
|
|
|
| 224 |
)
|
| 225 |
|
| 226 |
with gr.Row():
|
| 227 |
+
randomize_btn = gr.Button("🎲 Randomize", variant="secondary", size="lg")
|
| 228 |
+
|
| 229 |
+
with gr.Row():
|
| 230 |
+
submit = gr.Button("🎤 Generate Speech", variant="primary", scale=3, size="lg")
|
| 231 |
+
clear = gr.Button("🗑️ Clear", variant="stop", scale=1)
|
| 232 |
|
| 233 |
with gr.Accordion("Advanced Settings", open=False):
|
| 234 |
temperature = gr.Slider(
|
|
|
|
| 275 |
)
|
| 276 |
|
| 277 |
randomize_btn.click(
|
| 278 |
+
fn=randomize,
|
| 279 |
+
inputs=[],
|
| 280 |
+
outputs=[lang, gender, text_input],
|
| 281 |
)
|
| 282 |
|
| 283 |
def _clear():
|