mrfakename commited on
Commit
f249bd1
β€’
1 Parent(s): 0c995d0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -657,6 +657,10 @@ def randomsent():
657
  return random.choice(sents), '🎲'
658
  def clear_stuff():
659
  return "", "Synthesize", gr.update(visible=False), '', '', gr.update(visible=False), gr.update(visible=False), gr.update(visible=False), gr.update(visible=False), gr.update(visible=False), gr.update(visible=False), gr.update(visible=False)
 
 
 
 
660
  with gr.Blocks() as vote:
661
  useridstate = gr.State()
662
  gr.Markdown(INSTR)
@@ -682,7 +686,7 @@ with gr.Blocks() as vote:
682
  nxtroundbtn = gr.Button('Next round', visible=False)
683
  # outputs = [text, btn, r2, model1, model2, prevmodel1, aud1, prevmodel2, aud2, abetter, bbetter]
684
  outputs = [text, btn, r2, model1, model2, aud1, aud2, abetter, bbetter, prevmodel1, prevmodel2, nxtroundbtn]
685
- btn.click(synthandreturn, inputs=[text], outputs=outputs)
686
  nxtroundbtn.click(clear_stuff, outputs=outputs)
687
 
688
  # nxt_outputs = [prevmodel1, prevmodel2, abetter, bbetter]
 
657
  return random.choice(sents), '🎲'
658
  def clear_stuff():
659
  return "", "Synthesize", gr.update(visible=False), '', '', gr.update(visible=False), gr.update(visible=False), gr.update(visible=False), gr.update(visible=False), gr.update(visible=False), gr.update(visible=False), gr.update(visible=False)
660
+ def disable():
661
+ return gr.update(interactive=False)
662
+ def ensable():
663
+ return gr.update(interactive=True)
664
  with gr.Blocks() as vote:
665
  useridstate = gr.State()
666
  gr.Markdown(INSTR)
 
686
  nxtroundbtn = gr.Button('Next round', visible=False)
687
  # outputs = [text, btn, r2, model1, model2, prevmodel1, aud1, prevmodel2, aud2, abetter, bbetter]
688
  outputs = [text, btn, r2, model1, model2, aud1, aud2, abetter, bbetter, prevmodel1, prevmodel2, nxtroundbtn]
689
+ btn.click(disable, outputs=btn).then(synthandreturn, inputs=[text], outputs=outputs).then(enable, outputs=btn)
690
  nxtroundbtn.click(clear_stuff, outputs=outputs)
691
 
692
  # nxt_outputs = [prevmodel1, prevmodel2, abetter, bbetter]