zach commited on
Commit
f64ebd7
·
1 Parent(s): b41805f

Improve clarity of instructions, minor adjustment to UI component layout

Browse files
Files changed (1) hide show
  1. src/app.py +38 -41
src/app.py CHANGED
@@ -208,29 +208,27 @@ def reset_ui() -> Tuple[gr.update, gr.update, gr.update, gr.update, None, None,
208
 
209
  def build_input_section() -> Tuple[gr.Markdown, gr.Dropdown, gr.Textbox, gr.Button]:
210
  """ Builds the input section including instructions, sample prompt dropdown, prompt input, and generate button """
211
- with gr.Column(variant='panel'):
212
- instructions = gr.Markdown("""
213
- **Instructions**
214
- 1. **Enter or Generate Text:** Type directly in the Text box, or optionally enter a Prompt, click "Generate text", and edit if needed.
215
- 2. **Synthesize Speech:** Click "Synthesize speech" to generate two audio outputs.
216
- 3. **Listen & Compare:** Playback both options (A & B) to hear the differences.
217
- 4. **Vote for Your Favorite:** Click "Vote for option A" or "Vote for option B" to choose the best one.
218
- """)
219
- sample_prompt_dropdown = gr.Dropdown(
220
- choices=list(SAMPLE_PROMPTS.keys()),
221
- label='Choose a sample prompt (or enter your own)',
222
- value=None,
223
- interactive=True,
224
- )
225
- prompt_input = gr.Textbox(
226
- label='Prompt',
227
- placeholder='Enter your prompt...',
228
- lines=2,
229
- max_lines=2,
230
- max_length=PROMPT_MAX_LENGTH,
231
- show_copy_button=True,
232
- )
233
- generate_text_button = gr.Button('Generate text', variant='secondary')
234
  return (
235
  instructions,
236
  sample_prompt_dropdown,
@@ -241,24 +239,23 @@ def build_input_section() -> Tuple[gr.Markdown, gr.Dropdown, gr.Textbox, gr.Butt
241
 
242
  def build_output_section() -> Tuple[gr.Textbox, gr.Button, gr.Audio, gr.Audio, gr.Button, gr.Button]:
243
  """ Builds the output section including generated text, audio players, and vote buttons. """
244
- with gr.Column(variant='panel'):
245
- text_input = gr.Textbox(
246
- label='Text',
247
- placeholder='Enter text to synthesize speech...',
248
- interactive=True,
249
- autoscroll=False,
250
- lines=5,
251
- max_lines=5,
252
- max_length=PROMPT_MAX_LENGTH,
253
- show_copy_button=True,
254
- )
255
- synthesize_speech_button = gr.Button('Synthesize speech', variant='primary')
256
- with gr.Row(equal_height=True):
257
- option_a_audio_player = gr.Audio(label=OPTION_A, type='filepath', interactive=False)
258
- option_b_audio_player = gr.Audio(label=OPTION_B, type='filepath', interactive=False)
259
- with gr.Row(equal_height=True):
260
- vote_button_a = gr.Button(VOTE_FOR_OPTION_A, interactive=False)
261
- vote_button_b = gr.Button(VOTE_FOR_OPTION_B, interactive=False)
262
  return (
263
  text_input,
264
  synthesize_speech_button,
 
208
 
209
  def build_input_section() -> Tuple[gr.Markdown, gr.Dropdown, gr.Textbox, gr.Button]:
210
  """ Builds the input section including instructions, sample prompt dropdown, prompt input, and generate button """
211
+ instructions = gr.Markdown("""
212
+ 1. **Enter or Generate Text:** Type directly in the Text box, or optionally enter a Prompt, click "Generate text", and edit if needed.
213
+ 2. **Synthesize Speech:** Click "Synthesize speech" to generate two audio outputs.
214
+ 3. **Listen & Compare:** Playback both options (A & B) to hear the differences.
215
+ 4. **Vote for Your Favorite:** Click "Vote for option A" or "Vote for option B" to choose the best one.
216
+ """)
217
+ sample_prompt_dropdown = gr.Dropdown(
218
+ choices=list(SAMPLE_PROMPTS.keys()),
219
+ label='Choose a sample prompt (or enter your own)',
220
+ value=None,
221
+ interactive=True,
222
+ )
223
+ prompt_input = gr.Textbox(
224
+ label='Prompt',
225
+ placeholder='Enter your prompt...',
226
+ lines=2,
227
+ max_lines=2,
228
+ max_length=PROMPT_MAX_LENGTH,
229
+ show_copy_button=True,
230
+ )
231
+ generate_text_button = gr.Button('Generate text', variant='secondary')
 
 
232
  return (
233
  instructions,
234
  sample_prompt_dropdown,
 
239
 
240
  def build_output_section() -> Tuple[gr.Textbox, gr.Button, gr.Audio, gr.Audio, gr.Button, gr.Button]:
241
  """ Builds the output section including generated text, audio players, and vote buttons. """
242
+ text_input = gr.Textbox(
243
+ label='Text',
244
+ placeholder='Enter text to synthesize speech...',
245
+ interactive=True,
246
+ autoscroll=False,
247
+ lines=4,
248
+ max_lines=12,
249
+ max_length=PROMPT_MAX_LENGTH,
250
+ show_copy_button=True,
251
+ )
252
+ synthesize_speech_button = gr.Button('Synthesize speech', variant='primary')
253
+ with gr.Row(equal_height=True):
254
+ option_a_audio_player = gr.Audio(label=OPTION_A, type='filepath', interactive=False)
255
+ option_b_audio_player = gr.Audio(label=OPTION_B, type='filepath', interactive=False)
256
+ with gr.Row(equal_height=True):
257
+ vote_button_a = gr.Button(VOTE_FOR_OPTION_A, interactive=False)
258
+ vote_button_b = gr.Button(VOTE_FOR_OPTION_B, interactive=False)
 
259
  return (
260
  text_input,
261
  synthesize_speech_button,