Spaces:
Running
Running
zach
commited on
Commit
·
ae60c0f
1
Parent(s):
f076d8d
Update UI layout and improve instructions content
Browse files- src/app.py +47 -34
src/app.py
CHANGED
|
@@ -288,15 +288,16 @@ class App:
|
|
| 288 |
value=None,
|
| 289 |
interactive=True,
|
| 290 |
)
|
| 291 |
-
|
| 292 |
-
|
| 293 |
-
|
| 294 |
-
|
| 295 |
-
|
| 296 |
-
|
| 297 |
-
|
| 298 |
-
|
| 299 |
-
|
|
|
|
| 300 |
return (
|
| 301 |
sample_character_description_dropdown,
|
| 302 |
character_description_input,
|
|
@@ -307,17 +308,18 @@ class App:
|
|
| 307 |
"""
|
| 308 |
Builds the output section including text input, audio players, and vote buttons.
|
| 309 |
"""
|
| 310 |
-
|
| 311 |
-
|
| 312 |
-
|
| 313 |
-
|
| 314 |
-
|
| 315 |
-
|
| 316 |
-
|
| 317 |
-
|
| 318 |
-
|
| 319 |
-
|
| 320 |
-
|
|
|
|
| 321 |
|
| 322 |
with gr.Row(equal_height=True):
|
| 323 |
with gr.Column():
|
|
@@ -364,30 +366,42 @@ class App:
|
|
| 364 |
fill_width=True,
|
| 365 |
css_paths="src/assets/styles.css",
|
| 366 |
) as demo:
|
| 367 |
-
#
|
| 368 |
gr.Markdown("# Expressive TTS Arena")
|
| 369 |
-
|
|
|
|
| 370 |
"""
|
| 371 |
-
|
| 372 |
-
|
| 373 |
-
|
| 374 |
-
|
| 375 |
-
|
| 376 |
-
|
| 377 |
-
|
| 378 |
-
|
| 379 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 380 |
"""
|
| 381 |
)
|
| 382 |
|
| 383 |
-
# Build generate text section
|
| 384 |
(
|
| 385 |
sample_character_description_dropdown,
|
| 386 |
character_description_input,
|
| 387 |
generate_text_button,
|
| 388 |
) = self._build_input_section()
|
| 389 |
|
| 390 |
-
# Build synthesize speech section
|
| 391 |
(
|
| 392 |
text_input,
|
| 393 |
synthesize_speech_button,
|
|
@@ -412,7 +426,6 @@ class App:
|
|
| 412 |
vote_submitted_state = gr.State(False)
|
| 413 |
|
| 414 |
# --- Register event handlers ---
|
| 415 |
-
|
| 416 |
# When a sample character description is chosen, update the character description textbox
|
| 417 |
sample_character_description_dropdown.change(
|
| 418 |
fn=lambda choice: constants.SAMPLE_CHARACTER_DESCRIPTIONS.get(choice, ""),
|
|
|
|
| 288 |
value=None,
|
| 289 |
interactive=True,
|
| 290 |
)
|
| 291 |
+
with gr.Group():
|
| 292 |
+
character_description_input = gr.Textbox(
|
| 293 |
+
label="Character Description",
|
| 294 |
+
placeholder="Enter a character description...",
|
| 295 |
+
lines=3,
|
| 296 |
+
max_lines=8,
|
| 297 |
+
max_length=constants.CHARACTER_DESCRIPTION_MAX_LENGTH,
|
| 298 |
+
show_copy_button=True,
|
| 299 |
+
)
|
| 300 |
+
generate_text_button = gr.Button("Generate Text", variant="secondary")
|
| 301 |
return (
|
| 302 |
sample_character_description_dropdown,
|
| 303 |
character_description_input,
|
|
|
|
| 308 |
"""
|
| 309 |
Builds the output section including text input, audio players, and vote buttons.
|
| 310 |
"""
|
| 311 |
+
with gr.Group():
|
| 312 |
+
text_input = gr.Textbox(
|
| 313 |
+
label="Input Text",
|
| 314 |
+
placeholder="Enter or generate text for synthesis...",
|
| 315 |
+
interactive=True,
|
| 316 |
+
autoscroll=False,
|
| 317 |
+
lines=3,
|
| 318 |
+
max_lines=8,
|
| 319 |
+
max_length=constants.CHARACTER_DESCRIPTION_MAX_LENGTH,
|
| 320 |
+
show_copy_button=True,
|
| 321 |
+
)
|
| 322 |
+
synthesize_speech_button = gr.Button("Synthesize Speech", variant="primary")
|
| 323 |
|
| 324 |
with gr.Row(equal_height=True):
|
| 325 |
with gr.Column():
|
|
|
|
| 366 |
fill_width=True,
|
| 367 |
css_paths="src/assets/styles.css",
|
| 368 |
) as demo:
|
| 369 |
+
# --- UI components ---
|
| 370 |
gr.Markdown("# Expressive TTS Arena")
|
| 371 |
+
|
| 372 |
+
gr.HTML(
|
| 373 |
"""
|
| 374 |
+
<p><strong>Instructions</strong></p>
|
| 375 |
+
<ol style="margin-left: 8px;">
|
| 376 |
+
<li>
|
| 377 |
+
Choose or enter a character description by selecting a sample or typing your own to guide
|
| 378 |
+
text generation and voice synthesis.
|
| 379 |
+
</li>
|
| 380 |
+
<li>
|
| 381 |
+
Click the <strong>"Generate Text"</strong> button to create dialogue for the character;
|
| 382 |
+
the text automatically populates the input field for further editing.
|
| 383 |
+
</li>
|
| 384 |
+
<li>
|
| 385 |
+
Click the <strong>"Synthesize Speech"</strong> button to convert your text and character
|
| 386 |
+
description into two synthesized speech options for direct comparison.
|
| 387 |
+
</li>
|
| 388 |
+
<li>
|
| 389 |
+
Listen to both audio outputs to assess their expressiveness.
|
| 390 |
+
</li>
|
| 391 |
+
<li>
|
| 392 |
+
Click <strong>"Select Option A"</strong> or <strong>"Select Option B"</strong> to vote for
|
| 393 |
+
the most expressive result.
|
| 394 |
+
</li>
|
| 395 |
+
</ol>
|
| 396 |
"""
|
| 397 |
)
|
| 398 |
|
|
|
|
| 399 |
(
|
| 400 |
sample_character_description_dropdown,
|
| 401 |
character_description_input,
|
| 402 |
generate_text_button,
|
| 403 |
) = self._build_input_section()
|
| 404 |
|
|
|
|
| 405 |
(
|
| 406 |
text_input,
|
| 407 |
synthesize_speech_button,
|
|
|
|
| 426 |
vote_submitted_state = gr.State(False)
|
| 427 |
|
| 428 |
# --- Register event handlers ---
|
|
|
|
| 429 |
# When a sample character description is chosen, update the character description textbox
|
| 430 |
sample_character_description_dropdown.change(
|
| 431 |
fn=lambda choice: constants.SAMPLE_CHARACTER_DESCRIPTIONS.get(choice, ""),
|