Spaces:
Running
Running
aplayed bplayed extra components fix
Browse files- app/synth.py +19 -1
- app/ui_vote.py +5 -3
app/synth.py
CHANGED
|
@@ -257,6 +257,9 @@ def synthandreturn(text, autoplay, request: gr.Request):
|
|
| 257 |
gr.update(visible=False), #prevmodel1
|
| 258 |
gr.update(visible=False), #prevmodel2
|
| 259 |
gr.update(visible=False), #nxt round btn
|
|
|
|
|
|
|
|
|
|
| 260 |
)
|
| 261 |
|
| 262 |
# Battle Mode
|
|
@@ -376,4 +379,19 @@ def randomsent():
|
|
| 376 |
def randomsent_battle():
|
| 377 |
return tuple(randomsent()) + tuple(random_m())
|
| 378 |
def clear_stuff():
|
| 379 |
-
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 257 |
gr.update(visible=False), #prevmodel1
|
| 258 |
gr.update(visible=False), #prevmodel2
|
| 259 |
gr.update(visible=False), #nxt round btn
|
| 260 |
+
# reset gr.State aplayed & bplayed
|
| 261 |
+
False, #aplayed
|
| 262 |
+
False, #bplayed
|
| 263 |
)
|
| 264 |
|
| 265 |
# Battle Mode
|
|
|
|
| 379 |
def randomsent_battle():
|
| 380 |
return tuple(randomsent()) + tuple(random_m())
|
| 381 |
def clear_stuff():
|
| 382 |
+
return [
|
| 383 |
+
gr.update(visible=True, value="", elem_classes=[]),
|
| 384 |
+
"Synthesize",
|
| 385 |
+
gr.update(visible=False), # r2
|
| 386 |
+
'', # model1
|
| 387 |
+
'', # model2
|
| 388 |
+
gr.update(visible=False, interactive=False, autoplay=False), # aud1
|
| 389 |
+
gr.update(visible=False, interactive=False, autoplay=False), # aud2
|
| 390 |
+
gr.update(visible=False, interactive=False), #abetter
|
| 391 |
+
gr.update(visible=False, interactive=False), #bbetter
|
| 392 |
+
gr.update(visible=False), #prevmodel1
|
| 393 |
+
gr.update(visible=False), #prevmodel2
|
| 394 |
+
gr.update(visible=False), #nxt round btn
|
| 395 |
+
False, #aplayed
|
| 396 |
+
False, #bplayed
|
| 397 |
+
]
|
app/ui_vote.py
CHANGED
|
@@ -119,7 +119,9 @@ with gr.Blocks() as vote:
|
|
| 119 |
bbetter,
|
| 120 |
prevmodel1,
|
| 121 |
prevmodel2,
|
| 122 |
-
nxtroundbtn
|
|
|
|
|
|
|
| 123 |
]
|
| 124 |
"""
|
| 125 |
text,
|
|
@@ -153,8 +155,8 @@ with gr.Blocks() as vote:
|
|
| 153 |
aud1\
|
| 154 |
.stop(
|
| 155 |
unlock_vote,
|
| 156 |
-
outputs=[abetter, bbetter, aplayed, bplayed],
|
| 157 |
inputs=[autoplay, gr.State(value=0), aplayed, bplayed],
|
|
|
|
| 158 |
)\
|
| 159 |
.then(
|
| 160 |
None,
|
|
@@ -165,8 +167,8 @@ with gr.Blocks() as vote:
|
|
| 165 |
aud2\
|
| 166 |
.stop(
|
| 167 |
unlock_vote,
|
| 168 |
-
outputs=[abetter, bbetter, aplayed, bplayed],
|
| 169 |
inputs=[autoplay, gr.State(value=1), aplayed, bplayed],
|
|
|
|
| 170 |
)
|
| 171 |
# unblur text with JS; faster than sending output with elem_classes
|
| 172 |
aud2.stop(None, inputs=[aplayed], js="(a) => a ? "+ unblur_text_js +" : 0;")
|
|
|
|
| 119 |
bbetter,
|
| 120 |
prevmodel1,
|
| 121 |
prevmodel2,
|
| 122 |
+
nxtroundbtn,
|
| 123 |
+
aplayed,
|
| 124 |
+
bplayed,
|
| 125 |
]
|
| 126 |
"""
|
| 127 |
text,
|
|
|
|
| 155 |
aud1\
|
| 156 |
.stop(
|
| 157 |
unlock_vote,
|
|
|
|
| 158 |
inputs=[autoplay, gr.State(value=0), aplayed, bplayed],
|
| 159 |
+
outputs=[abetter, bbetter, aplayed, bplayed],
|
| 160 |
)\
|
| 161 |
.then(
|
| 162 |
None,
|
|
|
|
| 167 |
aud2\
|
| 168 |
.stop(
|
| 169 |
unlock_vote,
|
|
|
|
| 170 |
inputs=[autoplay, gr.State(value=1), aplayed, bplayed],
|
| 171 |
+
outputs=[abetter, bbetter, aplayed, bplayed],
|
| 172 |
)
|
| 173 |
# unblur text with JS; faster than sending output with elem_classes
|
| 174 |
aud2.stop(None, inputs=[aplayed], js="(a) => a ? "+ unblur_text_js +" : 0;")
|