Spaces:
Running
Running
mrfakename
commited on
Commit
•
bc21678
1
Parent(s):
abf1e6b
Update app.py
Browse files
app.py
CHANGED
@@ -831,6 +831,10 @@ def randomsent():
|
|
831 |
return random.choice(sents), '🎲'
|
832 |
def clear_stuff():
|
833 |
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)
|
|
|
|
|
|
|
|
|
834 |
with gr.Blocks() as vote:
|
835 |
useridstate = gr.State()
|
836 |
gr.Markdown(INSTR)
|
@@ -856,7 +860,7 @@ with gr.Blocks() as vote:
|
|
856 |
nxtroundbtn = gr.Button('Next round', visible=False)
|
857 |
# outputs = [text, btn, r2, model1, model2, prevmodel1, aud1, prevmodel2, aud2, abetter, bbetter]
|
858 |
outputs = [text, btn, r2, model1, model2, aud1, aud2, abetter, bbetter, prevmodel1, prevmodel2, nxtroundbtn]
|
859 |
-
btn.click(synthandreturn, inputs=[text], outputs=outputs)
|
860 |
nxtroundbtn.click(clear_stuff, outputs=outputs)
|
861 |
|
862 |
# nxt_outputs = [prevmodel1, prevmodel2, abetter, bbetter]
|
|
|
831 |
return random.choice(sents), '🎲'
|
832 |
def clear_stuff():
|
833 |
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)
|
834 |
+
def disable():
|
835 |
+
return gr.update(interactive=False)
|
836 |
+
def ensable():
|
837 |
+
return gr.update(interactive=True)
|
838 |
with gr.Blocks() as vote:
|
839 |
useridstate = gr.State()
|
840 |
gr.Markdown(INSTR)
|
|
|
860 |
nxtroundbtn = gr.Button('Next round', visible=False)
|
861 |
# outputs = [text, btn, r2, model1, model2, prevmodel1, aud1, prevmodel2, aud2, abetter, bbetter]
|
862 |
outputs = [text, btn, r2, model1, model2, aud1, aud2, abetter, bbetter, prevmodel1, prevmodel2, nxtroundbtn]
|
863 |
+
btn.click(disable, outputs=btn).then(synthandreturn, inputs=[text], outputs=outputs).then(enable, outputs=btn)
|
864 |
nxtroundbtn.click(clear_stuff, outputs=outputs)
|
865 |
|
866 |
# nxt_outputs = [prevmodel1, prevmodel2, abetter, bbetter]
|