mrfakename commited on
Commit
85e1ca3
1 Parent(s): 4255bad

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -583,6 +583,8 @@ def synthandreturn(text):
583
  # gr.update(visible=False),
584
  # gr.update(visible=False), #nxt round btn
585
  # )
 
 
586
  def randomsent():
587
  return random.choice(sents), '🎲'
588
  def clear_stuff():
@@ -609,14 +611,17 @@ with gr.Blocks() as vote:
609
  aud2 = gr.Audio(interactive=False, show_label=False, show_download_button=False, show_share_button=False, waveform_options={'waveform_progress_color': '#3C82F6'})
610
  bbetter = gr.Button("B is better", variant='primary')
611
  prevmodel2 = gr.Textbox(interactive=False, show_label=False, container=False, value="Vote to reveal model B", text_align="center", lines=1, max_lines=1, visible=False)
612
- nxtroundbtn = gr.Button('Next round', visible=False)
 
 
613
  # outputs = [text, btn, r2, model1, model2, prevmodel1, aud1, prevmodel2, aud2, abetter, bbetter]
614
- outputs = [text, btn, r2, model1, model2, aud1, aud2, abetter, bbetter, prevmodel1, prevmodel2, nxtroundbtn]
615
  btn.click(synthandreturn, inputs=[text], outputs=outputs)
 
616
  nxtroundbtn.click(clear_stuff, outputs=outputs)
617
 
618
  # nxt_outputs = [prevmodel1, prevmodel2, abetter, bbetter]
619
- nxt_outputs = [abetter, bbetter, prevmodel1, prevmodel2, nxtroundbtn]
620
  abetter.click(a_is_better, outputs=nxt_outputs, inputs=[model1, model2, useridstate])
621
  bbetter.click(b_is_better, outputs=nxt_outputs, inputs=[model1, model2, useridstate])
622
  # skipbtn.click(b_is_better, outputs=outputs, inputs=[model1, model2, useridstate])
 
583
  # gr.update(visible=False),
584
  # gr.update(visible=False), #nxt round btn
585
  # )
586
+ def randsynthandreturn():
587
+ return synthandreturn(random.choice(sents))
588
  def randomsent():
589
  return random.choice(sents), '🎲'
590
  def clear_stuff():
 
611
  aud2 = gr.Audio(interactive=False, show_label=False, show_download_button=False, show_share_button=False, waveform_options={'waveform_progress_color': '#3C82F6'})
612
  bbetter = gr.Button("B is better", variant='primary')
613
  prevmodel2 = gr.Textbox(interactive=False, show_label=False, container=False, value="Vote to reveal model B", text_align="center", lines=1, max_lines=1, visible=False)
614
+ with gr.Row(visible=False) as nrb:
615
+ nxtroundbtn = gr.Button('Next round', scale=100)
616
+ randomnext = gr.Button('🎲➡️', scale=0, min_width=0)
617
  # outputs = [text, btn, r2, model1, model2, prevmodel1, aud1, prevmodel2, aud2, abetter, bbetter]
618
+ outputs = [text, btn, r2, model1, model2, aud1, aud2, abetter, bbetter, prevmodel1, prevmodel2, nrb]
619
  btn.click(synthandreturn, inputs=[text], outputs=outputs)
620
+ randomnext.click(randsynthandreturn, outputs=outputs)
621
  nxtroundbtn.click(clear_stuff, outputs=outputs)
622
 
623
  # nxt_outputs = [prevmodel1, prevmodel2, abetter, bbetter]
624
+ nxt_outputs = [abetter, bbetter, prevmodel1, prevmodel2, nrb]
625
  abetter.click(a_is_better, outputs=nxt_outputs, inputs=[model1, model2, useridstate])
626
  bbetter.click(b_is_better, outputs=nxt_outputs, inputs=[model1, model2, useridstate])
627
  # skipbtn.click(b_is_better, outputs=outputs, inputs=[model1, model2, useridstate])