Spaces:
Running
Running
zach commited on
Commit ·
60bcef1
1
Parent(s): afdac46
Update UI such that instructions are part of input section
Browse files- src/app.py +13 -11
src/app.py
CHANGED
|
@@ -106,8 +106,8 @@ def run_process_prompt(prompt: str):
|
|
| 106 |
gr.update(value=None), # Clear Option 1 audio
|
| 107 |
gr.update(value=None), # Clear Option 2 audio
|
| 108 |
None, # Clear option mapping
|
| 109 |
-
gr.update(interactive=False, value=VOTE_FOR_OPTION_ONE, variant=
|
| 110 |
-
gr.update(interactive=False, value=VOTE_FOR_OPTION_TWO, variant=
|
| 111 |
None, # Reset Option 2 audio state
|
| 112 |
)
|
| 113 |
|
|
@@ -166,14 +166,16 @@ def build_gradio_interface() -> gr.Blocks:
|
|
| 166 |
gr.Blocks: The Gradio UI layout.
|
| 167 |
"""
|
| 168 |
with gr.Blocks() as demo:
|
| 169 |
-
# Title
|
| 170 |
gr.Markdown('# Expressive TTS Arena')
|
| 171 |
-
gr.Markdown(
|
| 172 |
-
'Generate text using **Claude by Anthropic**, then compare text-to-speech outputs '
|
| 173 |
-
'from **Hume AI** and **ElevenLabs**. Listen to both samples and vote for your favorite!'
|
| 174 |
-
)
|
| 175 |
|
| 176 |
-
with gr.Column(variant=
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 177 |
# Sample prompt select
|
| 178 |
with gr.Row():
|
| 179 |
sample_prompt_dropdown = gr.Dropdown(
|
|
@@ -194,9 +196,9 @@ def build_gradio_interface() -> gr.Blocks:
|
|
| 194 |
)
|
| 195 |
|
| 196 |
# Generate Button
|
| 197 |
-
generate_button = gr.Button('Generate', variant=
|
| 198 |
|
| 199 |
-
with gr.Column(variant=
|
| 200 |
# Output text
|
| 201 |
output_text = gr.Textbox(
|
| 202 |
label='Generated Text',
|
|
@@ -223,7 +225,7 @@ def build_gradio_interface() -> gr.Blocks:
|
|
| 223 |
|
| 224 |
# Event handlers
|
| 225 |
sample_prompt_dropdown.change(
|
| 226 |
-
fn=lambda choice: SAMPLE_PROMPTS.get(choice,
|
| 227 |
inputs=[sample_prompt_dropdown],
|
| 228 |
outputs=[prompt_input],
|
| 229 |
)
|
|
|
|
| 106 |
gr.update(value=None), # Clear Option 1 audio
|
| 107 |
gr.update(value=None), # Clear Option 2 audio
|
| 108 |
None, # Clear option mapping
|
| 109 |
+
gr.update(interactive=False, value=VOTE_FOR_OPTION_ONE, variant='secondary'), # Reset vote button 1
|
| 110 |
+
gr.update(interactive=False, value=VOTE_FOR_OPTION_TWO, variant='secondary'), # Reset vote button 2
|
| 111 |
None, # Reset Option 2 audio state
|
| 112 |
)
|
| 113 |
|
|
|
|
| 166 |
gr.Blocks: The Gradio UI layout.
|
| 167 |
"""
|
| 168 |
with gr.Blocks() as demo:
|
| 169 |
+
# Title
|
| 170 |
gr.Markdown('# Expressive TTS Arena')
|
|
|
|
|
|
|
|
|
|
|
|
|
| 171 |
|
| 172 |
+
with gr.Column(variant='compact'):
|
| 173 |
+
# Instructions
|
| 174 |
+
gr.Markdown(
|
| 175 |
+
'Generate text using **Claude by Anthropic**, then compare text-to-speech outputs '
|
| 176 |
+
'from **Hume AI** and **ElevenLabs**. Listen to both samples and vote for your favorite!'
|
| 177 |
+
)
|
| 178 |
+
|
| 179 |
# Sample prompt select
|
| 180 |
with gr.Row():
|
| 181 |
sample_prompt_dropdown = gr.Dropdown(
|
|
|
|
| 196 |
)
|
| 197 |
|
| 198 |
# Generate Button
|
| 199 |
+
generate_button = gr.Button('Generate', variant='primary')
|
| 200 |
|
| 201 |
+
with gr.Column(variant='compact'):
|
| 202 |
# Output text
|
| 203 |
output_text = gr.Textbox(
|
| 204 |
label='Generated Text',
|
|
|
|
| 225 |
|
| 226 |
# Event handlers
|
| 227 |
sample_prompt_dropdown.change(
|
| 228 |
+
fn=lambda choice: SAMPLE_PROMPTS.get(choice, ''),
|
| 229 |
inputs=[sample_prompt_dropdown],
|
| 230 |
outputs=[prompt_input],
|
| 231 |
)
|