Spaces:
Running
Running
changed intro text; blur text for cached; unblur after actions
Browse files
app.py
CHANGED
@@ -437,9 +437,9 @@ Vote to help the community find the best available text-to-speech model!
|
|
437 |
INSTR = """
|
438 |
## π³οΈ Vote
|
439 |
|
440 |
-
* Input text (πΊπΈ English only) to synthesize audio.
|
441 |
* Press β‘ to get cached sample pairs you've yet to vote on. (Fast π)
|
442 |
-
*
|
|
|
443 |
* Listen to the two audio clips, one after the other.
|
444 |
* Vote on which audio sounds more natural to you.
|
445 |
* _Note: Model names are revealed after the vote is cast._
|
@@ -1195,7 +1195,7 @@ def give_cached_sample(session_hash: str, request: gr.Request):
|
|
1195 |
]
|
1196 |
|
1197 |
return (
|
1198 |
-
pair[0].transcript,
|
1199 |
"Synthesize",
|
1200 |
gr.update(visible=True), # r2
|
1201 |
pair[0].modelName, # model1
|
@@ -1231,7 +1231,7 @@ def randomsent():
|
|
1231 |
return 'β‘', random.choice(sents), 'π²'
|
1232 |
def clear_stuff():
|
1233 |
return [
|
1234 |
-
"",
|
1235 |
"Synthesize",
|
1236 |
gr.update(visible=False), # r2
|
1237 |
'', # model1
|
@@ -1251,7 +1251,8 @@ def disable():
|
|
1251 |
return [gr.update(interactive=False), gr.update(interactive=False), gr.update(interactive=False), gr.update(interactive=False)]
|
1252 |
def enable():
|
1253 |
return [gr.update(interactive=True), gr.update(interactive=True), gr.update(interactive=True), gr.update(interactive=True)]
|
1254 |
-
|
|
|
1255 |
|
1256 |
with gr.Blocks() as vote:
|
1257 |
session_hash = gr.Textbox(visible=False, value='')
|
@@ -1267,7 +1268,9 @@ with gr.Blocks() as vote:
|
|
1267 |
cachedt = gr.Button('β‘', scale=0, min_width=0, variant='tool', interactive=True)
|
1268 |
text = gr.Textbox(container=False, show_label=False, placeholder="Enter text to synthesize", lines=1, max_lines=1, scale=9999999, min_width=0)
|
1269 |
randomt = gr.Button('π²', scale=0, min_width=0, variant='tool')
|
1270 |
-
randomt
|
|
|
|
|
1271 |
btn = gr.Button("Synthesize", variant='primary')
|
1272 |
model1 = gr.Textbox(interactive=False, lines=1, max_lines=1, visible=False)
|
1273 |
#model1 = gr.Textbox(interactive=False, lines=1, max_lines=1, visible=True)
|
@@ -1332,7 +1335,8 @@ with gr.Blocks() as vote:
|
|
1332 |
btn\
|
1333 |
.click(disable, outputs=[btn, abetter, bbetter, cachedt])\
|
1334 |
.then(synthandreturn, inputs=[text], outputs=outputs)\
|
1335 |
-
.then(enable, outputs=[btn, gr.State(), gr.State(), cachedt])
|
|
|
1336 |
nxtroundbtn\
|
1337 |
.click(disable, outputs=[btn, abetter, bbetter, cachedt])\
|
1338 |
.then(give_cached_sample, inputs=[session_hash], outputs=[*outputs, cachedt])\
|
@@ -1363,7 +1367,16 @@ with gr.Blocks() as vote:
|
|
1363 |
unlock_vote,
|
1364 |
outputs=[abetter, bbetter, aplayed, bplayed],
|
1365 |
inputs=[gr.State(value=1), aplayed, bplayed],
|
1366 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1367 |
|
1368 |
# nxt_outputs = [prevmodel1, prevmodel2, abetter, bbetter]
|
1369 |
nxt_outputs = [abetter, bbetter, prevmodel1, prevmodel2, nxtroundbtn]
|
@@ -1394,7 +1407,7 @@ with gr.Blocks() as about:
|
|
1394 |
# dbtext = gr.Textbox(label="Type \"delete db\" to confirm", placeholder="delete db")
|
1395 |
# ddb = gr.Button("Delete DB")
|
1396 |
# ddb.click(del_db, inputs=dbtext, outputs=ddb)
|
1397 |
-
with gr.Blocks(theme=theme, css="footer {visibility: hidden}textbox{resize:none}", js="cookie.js", title="TTS Arena") as demo:
|
1398 |
gr.Markdown(DESCR)
|
1399 |
# gr.TabbedInterface([vote, leaderboard, about, admin], ['Vote', 'Leaderboard', 'About', 'Admin (ONLY IN BETA)'])
|
1400 |
gr.TabbedInterface([vote, leaderboard, about], ['π³οΈ Vote', 'π Leaderboard', 'π About'])
|
|
|
437 |
INSTR = """
|
438 |
## π³οΈ Vote
|
439 |
|
|
|
440 |
* Press β‘ to get cached sample pairs you've yet to vote on. (Fast π)
|
441 |
+
* Or press π² to randomly use text from a preselected list. (Slow π’)
|
442 |
+
* Or input text (πΊπΈ English only) to synthesize audio. (Slowest π due to _Toxicity_ test)
|
443 |
* Listen to the two audio clips, one after the other.
|
444 |
* Vote on which audio sounds more natural to you.
|
445 |
* _Note: Model names are revealed after the vote is cast._
|
|
|
1195 |
]
|
1196 |
|
1197 |
return (
|
1198 |
+
gr.update(visible=True, value=pair[0].transcript, elem_classes=['blurred-text']),
|
1199 |
"Synthesize",
|
1200 |
gr.update(visible=True), # r2
|
1201 |
pair[0].modelName, # model1
|
|
|
1231 |
return 'β‘', random.choice(sents), 'π²'
|
1232 |
def clear_stuff():
|
1233 |
return [
|
1234 |
+
gr.update(visible=True, value="", elem_classes=[]),
|
1235 |
"Synthesize",
|
1236 |
gr.update(visible=False), # r2
|
1237 |
'', # model1
|
|
|
1251 |
return [gr.update(interactive=False), gr.update(interactive=False), gr.update(interactive=False), gr.update(interactive=False)]
|
1252 |
def enable():
|
1253 |
return [gr.update(interactive=True), gr.update(interactive=True), gr.update(interactive=True), gr.update(interactive=True)]
|
1254 |
+
def unblur_text():
|
1255 |
+
return gr.update(elem_classes=[])
|
1256 |
|
1257 |
with gr.Blocks() as vote:
|
1258 |
session_hash = gr.Textbox(visible=False, value='')
|
|
|
1268 |
cachedt = gr.Button('β‘', scale=0, min_width=0, variant='tool', interactive=True)
|
1269 |
text = gr.Textbox(container=False, show_label=False, placeholder="Enter text to synthesize", lines=1, max_lines=1, scale=9999999, min_width=0)
|
1270 |
randomt = gr.Button('π²', scale=0, min_width=0, variant='tool')
|
1271 |
+
randomt\
|
1272 |
+
.click(randomsent, outputs=[cachedt, text, randomt])\
|
1273 |
+
.then(unblur_text, outputs=text)
|
1274 |
btn = gr.Button("Synthesize", variant='primary')
|
1275 |
model1 = gr.Textbox(interactive=False, lines=1, max_lines=1, visible=False)
|
1276 |
#model1 = gr.Textbox(interactive=False, lines=1, max_lines=1, visible=True)
|
|
|
1335 |
btn\
|
1336 |
.click(disable, outputs=[btn, abetter, bbetter, cachedt])\
|
1337 |
.then(synthandreturn, inputs=[text], outputs=outputs)\
|
1338 |
+
.then(enable, outputs=[btn, gr.State(), gr.State(), cachedt])\
|
1339 |
+
.then(unblur_text, outputs=text)
|
1340 |
nxtroundbtn\
|
1341 |
.click(disable, outputs=[btn, abetter, bbetter, cachedt])\
|
1342 |
.then(give_cached_sample, inputs=[session_hash], outputs=[*outputs, cachedt])\
|
|
|
1367 |
unlock_vote,
|
1368 |
outputs=[abetter, bbetter, aplayed, bplayed],
|
1369 |
inputs=[gr.State(value=1), aplayed, bplayed],
|
1370 |
+
)\
|
1371 |
+
.then(unblur_text, outputs=text)
|
1372 |
+
# aud1.input(
|
1373 |
+
# None,
|
1374 |
+
# js="() => {console.log(new Date().getTime().toString()+'input')}",
|
1375 |
+
# )
|
1376 |
+
# aud1.change(
|
1377 |
+
# None,
|
1378 |
+
# js="() => {console.log(new Date().getTime().toString()+'change')}",
|
1379 |
+
# )
|
1380 |
|
1381 |
# nxt_outputs = [prevmodel1, prevmodel2, abetter, bbetter]
|
1382 |
nxt_outputs = [abetter, bbetter, prevmodel1, prevmodel2, nxtroundbtn]
|
|
|
1407 |
# dbtext = gr.Textbox(label="Type \"delete db\" to confirm", placeholder="delete db")
|
1408 |
# ddb = gr.Button("Delete DB")
|
1409 |
# ddb.click(del_db, inputs=dbtext, outputs=ddb)
|
1410 |
+
with gr.Blocks(theme=theme, css="footer {visibility: hidden}textbox{resize:none} .blurred-text {filter: blur(0.15em);}", js="cookie.js", title="TTS Arena") as demo:
|
1411 |
gr.Markdown(DESCR)
|
1412 |
# gr.TabbedInterface([vote, leaderboard, about, admin], ['Vote', 'Leaderboard', 'About', 'Admin (ONLY IN BETA)'])
|
1413 |
gr.TabbedInterface([vote, leaderboard, about], ['π³οΈ Vote', 'π Leaderboard', 'π About'])
|