mrfakename commited on
Commit
c4e7fbc
1 Parent(s): 8abe551

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -9
app.py CHANGED
@@ -371,7 +371,8 @@ def reload(chosenmodel1=None, chosenmodel2=None, userid=None):
371
  # if chosenmodel1: out.append(f'This model was {chosenmodel1}')
372
  # if chosenmodel2: out.append(f'This model was {chosenmodel2}')
373
  # return out
374
- return (f'This model was {chosenmodel1}', f'This model was {chosenmodel2}', gr.update(visible=False), gr.update(visible=False))
 
375
 
376
  with gr.Blocks() as leaderboard:
377
  gr.Markdown(LDESC)
@@ -441,13 +442,13 @@ def synthandreturn(text):
441
  gr.update(visible=True), # r2
442
  mdl1, # model1
443
  mdl2, # model2
444
- 'Vote to reveal model A', # prevmodel1
445
  router.predict(
446
  text,
447
  AVAILABLE_MODELS[mdl1],
448
  api_name="/synthesize"
449
  ), # aud1
450
- 'Vote to reveal model B', # prevmodel2
451
  router.predict(
452
  text,
453
  AVAILABLE_MODELS[mdl2],
@@ -467,18 +468,20 @@ with gr.Blocks() as vote:
467
  with gr.Row(visible=False) as r2:
468
  with gr.Column():
469
  with gr.Group():
470
- prevmodel1 = gr.Textbox(interactive=False, show_label=False, container=False, value="Vote to reveal model A", text_align="center", lines=1, max_lines=1)
471
  aud1 = gr.Audio(interactive=False, show_label=False, show_download_button=False, show_share_button=False, waveform_options={'waveform_progress_color': '#3C82F6'})
472
- abetter = gr.Button("A is better")
473
  with gr.Column():
474
  with gr.Group():
475
- prevmodel2 = gr.Textbox(interactive=False, show_label=False, container=False, value="Vote to reveal model B", text_align="center", lines=1, max_lines=1)
476
  aud2 = gr.Audio(interactive=False, show_label=False, show_download_button=False, show_share_button=False, waveform_options={'waveform_progress_color': '#3C82F6'})
477
- bbetter = gr.Button("B is better")
478
- outputs = [text, btn, r2, model1, model2, prevmodel1, aud1, prevmodel2, aud2, abetter, bbetter]
 
479
  btn.click(synthandreturn, inputs=[text], outputs=outputs)
480
 
481
- nxt_outputs = [prevmodel1, prevmodel2, abetter, bbetter]
 
482
  abetter.click(a_is_better, outputs=nxt_outputs, inputs=[model1, model2, useridstate])
483
  bbetter.click(b_is_better, outputs=nxt_outputs, inputs=[model1, model2, useridstate])
484
  # skipbtn.click(b_is_better, outputs=outputs, inputs=[model1, model2, useridstate])
 
371
  # if chosenmodel1: out.append(f'This model was {chosenmodel1}')
372
  # if chosenmodel2: out.append(f'This model was {chosenmodel2}')
373
  # return out
374
+ # return (f'This model was {chosenmodel1}', f'This model was {chosenmodel2}', gr.update(visible=False), gr.update(visible=False))
375
+ return (gr.update(visible=False, value=chosenmodel1), gr.update(visible=False, value=chosenmodel2))
376
 
377
  with gr.Blocks() as leaderboard:
378
  gr.Markdown(LDESC)
 
442
  gr.update(visible=True), # r2
443
  mdl1, # model1
444
  mdl2, # model2
445
+ # 'Vote to reveal model A', # prevmodel1
446
  router.predict(
447
  text,
448
  AVAILABLE_MODELS[mdl1],
449
  api_name="/synthesize"
450
  ), # aud1
451
+ # 'Vote to reveal model B', # prevmodel2
452
  router.predict(
453
  text,
454
  AVAILABLE_MODELS[mdl2],
 
468
  with gr.Row(visible=False) as r2:
469
  with gr.Column():
470
  with gr.Group():
471
+ # prevmodel1 = gr.Textbox(interactive=False, show_label=False, container=False, value="Vote to reveal model A", text_align="center", lines=1, max_lines=1)
472
  aud1 = gr.Audio(interactive=False, show_label=False, show_download_button=False, show_share_button=False, waveform_options={'waveform_progress_color': '#3C82F6'})
473
+ abetter = gr.Button("A is better", variant='primary')
474
  with gr.Column():
475
  with gr.Group():
476
+ # prevmodel2 = gr.Textbox(interactive=False, show_label=False, container=False, value="Vote to reveal model B", text_align="center", lines=1, max_lines=1)
477
  aud2 = gr.Audio(interactive=False, show_label=False, show_download_button=False, show_share_button=False, waveform_options={'waveform_progress_color': '#3C82F6'})
478
+ bbetter = gr.Button("B is better", variant='primary')
479
+ # outputs = [text, btn, r2, model1, model2, prevmodel1, aud1, prevmodel2, aud2, abetter, bbetter]
480
+ outputs = [text, btn, r2, model1, model2, aud1, aud2, abetter, bbetter]
481
  btn.click(synthandreturn, inputs=[text], outputs=outputs)
482
 
483
+ # nxt_outputs = [prevmodel1, prevmodel2, abetter, bbetter]
484
+ nxt_outputs = [abetter, bbetter]
485
  abetter.click(a_is_better, outputs=nxt_outputs, inputs=[model1, model2, useridstate])
486
  bbetter.click(b_is_better, outputs=nxt_outputs, inputs=[model1, model2, useridstate])
487
  # skipbtn.click(b_is_better, outputs=outputs, inputs=[model1, model2, useridstate])