mrfakename commited on
Commit
5c02356
1 Parent(s): 4db71ad

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -8
app.py CHANGED
@@ -396,15 +396,19 @@ with gr.Blocks() as leaderboard:
396
  # bothgood.click(both_good, outputs=outputs, inputs=[model1, model2, useridstate])
397
 
398
  # vote.load(reload, outputs=[aud1, aud2, model1, model2])
 
 
 
 
399
  def makevisible(text):
400
  print(text)
401
  return (
402
  'None', # model1
403
  'None', # model2
404
- gr.update(visible=True), # prevmodel1
405
- gr.update(visible=True), # aud1
406
- gr.update(visible=True), # prevmodel2
407
- gr.update(visible=True), # aud2
408
  )
409
  with gr.Blocks() as vote:
410
  useridstate = gr.State()
@@ -421,12 +425,16 @@ with gr.Blocks() as vote:
421
  with gr.Row():
422
  with gr.Column():
423
  with gr.Group():
424
- prevmodel1 = gr.Textbox(interactive=False, show_label=False, container=False, value="Vote to reveal model A", lines=1, max_lines=1)
425
- aud1 = gr.Audio(interactive=False, show_label=False, show_download_button=False, show_share_button=False, waveform_options={'waveform_progress_color': '#3C82F6'})
 
 
426
  with gr.Column():
427
  with gr.Group():
428
- prevmodel2 = gr.Textbox(interactive=False, show_label=False, container=False, value="Vote to reveal model B", text_align="right", lines=1, max_lines=1)
429
- aud2 = gr.Audio(interactive=False, show_label=False, show_download_button=False, show_share_button=False, waveform_options={'waveform_progress_color': '#3C82F6'})
 
 
430
  with gr.Row(visible=False):
431
  abetter = gr.Button("A is Better", variant='primary')
432
  bbetter = gr.Button("B is Better", variant='primary')
 
396
  # bothgood.click(both_good, outputs=outputs, inputs=[model1, model2, useridstate])
397
 
398
  # vote.load(reload, outputs=[aud1, aud2, model1, model2])
399
+ def get_txtbox(value, visible=False):
400
+ return gr.Textbox(interactive=False, show_label=False, container=False, value=value, lines=1, max_lines=1, visible=visible)
401
+ def get_audio(value=None, visible=False):
402
+ return gr.Audio(value=value, interactive=False, show_label=False, show_download_button=False, show_share_button=False, waveform_options={'waveform_progress_color': '#3C82F6'}, visible=visible)
403
  def makevisible(text):
404
  print(text)
405
  return (
406
  'None', # model1
407
  'None', # model2
408
+ get_txtbox('Vote to reveal model A', True), # prevmodel1
409
+ get_audio(visible=True), # aud1
410
+ get_txtbox('Vote to reveal model B', True), # prevmodel2
411
+ get_audio(visible=True), # aud2
412
  )
413
  with gr.Blocks() as vote:
414
  useridstate = gr.State()
 
425
  with gr.Row():
426
  with gr.Column():
427
  with gr.Group():
428
+ # prevmodel1 = gr.Textbox(interactive=False, show_label=False, container=False, value="Vote to reveal model A", lines=1, max_lines=1)
429
+ prevmodel1 = get_txtbox('Vote to reveal model A')
430
+ aud1 = get_audio()
431
+ # aud1 = gr.Audio(interactive=False, show_label=False, show_download_button=False, show_share_button=False, waveform_options={'waveform_progress_color': '#3C82F6'})
432
  with gr.Column():
433
  with gr.Group():
434
+ # prevmodel2 = gr.Textbox(interactive=False, show_label=False, container=False, value="Vote to reveal model B", text_align="right", lines=1, max_lines=1)
435
+ prevmodel2 = get_txtbox('Vote to reveal model B')
436
+ aud2 = get_audio()
437
+ # aud2 = gr.Audio(interactive=False, show_label=False, show_download_button=False, show_share_button=False, waveform_options={'waveform_progress_color': '#3C82F6'})
438
  with gr.Row(visible=False):
439
  abetter = gr.Button("A is Better", variant='primary')
440
  bbetter = gr.Button("B is Better", variant='primary')