Pendrokar commited on
Commit
3617d86
β€’
1 Parent(s): c177a79

detached cookie.js; play second sample fix

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -1288,6 +1288,7 @@ def voted_on_cached(modelName1: str, modelName2: str, transcript: str, session_h
1288
  hash2 = md5(bytes((modelName2 + transcript).encode('ascii'))).hexdigest()
1289
 
1290
  voting_users[userid].voted_pairs.add((hash1, hash2))
 
1291
 
1292
  def randomsent():
1293
  return '⚑', random.choice(sents), '🎲'
@@ -1364,7 +1365,6 @@ with gr.Blocks() as vote:
1364
  scale=9999999,
1365
  min_width=0,
1366
  elem_id="arena-text-input",
1367
- elem_classes="blurred-text",
1368
  )
1369
  randomt = gr.Button('🎲', scale=0, min_width=0, variant='tool')
1370
  randomt\
@@ -1470,7 +1470,7 @@ with gr.Blocks() as vote:
1470
  .then(
1471
  None,
1472
  inputs=[bplayed],
1473
- js="(b) => b ? 0 : document.querySelector('.stretch .gap+.gap button.play-pause-button').click()",
1474
  )
1475
  # autoplay if unplayed
1476
  aud2\
@@ -1492,11 +1492,11 @@ with gr.Blocks() as vote:
1492
  # nxt_outputs = [prevmodel1, prevmodel2, abetter, bbetter]
1493
  nxt_outputs = [abetter, bbetter, prevmodel1, prevmodel2, nxtroundbtn]
1494
  abetter\
1495
- .click(a_is_better, outputs=nxt_outputs, inputs=[model1, model2, useridstate])\
1496
- .then(voted_on_cached, inputs=[model1, model2, text, session_hash])
1497
  bbetter\
1498
- .click(b_is_better, outputs=nxt_outputs, inputs=[model1, model2, useridstate])\
1499
- .then(voted_on_cached, inputs=[model1, model2, text, session_hash])
1500
  # skipbtn.click(b_is_better, outputs=outputs, inputs=[model1, model2, useridstate])
1501
 
1502
  # bothbad.click(both_bad, outputs=outputs, inputs=[model1, model2, useridstate])
@@ -1524,7 +1524,7 @@ with gr.Blocks() as about:
1524
  # ddb = gr.Button("Delete DB")
1525
  # ddb.click(del_db, inputs=dbtext, outputs=ddb)
1526
  # Blur cached sample text so the voting user picks up mispronouncements
1527
- with gr.Blocks(theme=theme, css="footer {visibility: hidden}textbox{resize:none} .blurred-text {filter: blur(0.15em);}", head=shortcut_js, js="cookie.js", title="TTS Arena") as demo:
1528
  gr.Markdown(DESCR)
1529
  # gr.TabbedInterface([vote, leaderboard, about, admin], ['Vote', 'Leaderboard', 'About', 'Admin (ONLY IN BETA)'])
1530
  gr.TabbedInterface([vote, leaderboard, about], ['πŸ—³οΈ Vote', 'πŸ† Leaderboard', 'πŸ“„ About'])
 
1288
  hash2 = md5(bytes((modelName2 + transcript).encode('ascii'))).hexdigest()
1289
 
1290
  voting_users[userid].voted_pairs.add((hash1, hash2))
1291
+ return []
1292
 
1293
  def randomsent():
1294
  return '⚑', random.choice(sents), '🎲'
 
1365
  scale=9999999,
1366
  min_width=0,
1367
  elem_id="arena-text-input",
 
1368
  )
1369
  randomt = gr.Button('🎲', scale=0, min_width=0, variant='tool')
1370
  randomt\
 
1470
  .then(
1471
  None,
1472
  inputs=[bplayed],
1473
+ js="(b) => b ? 0 : document.querySelector('.row .gap+.gap button.play-pause-button').click()",
1474
  )
1475
  # autoplay if unplayed
1476
  aud2\
 
1492
  # nxt_outputs = [prevmodel1, prevmodel2, abetter, bbetter]
1493
  nxt_outputs = [abetter, bbetter, prevmodel1, prevmodel2, nxtroundbtn]
1494
  abetter\
1495
+ .click(a_is_better, outputs=nxt_outputs, inputs=[model1, model2, useridstate, text])\
1496
+ .then(voted_on_cached, inputs=[model1, model2, text, session_hash], outputs=[])
1497
  bbetter\
1498
+ .click(b_is_better, outputs=nxt_outputs, inputs=[model1, model2, useridstate, text])\
1499
+ .then(voted_on_cached, inputs=[model1, model2, text, session_hash], outputs=[])
1500
  # skipbtn.click(b_is_better, outputs=outputs, inputs=[model1, model2, useridstate])
1501
 
1502
  # bothbad.click(both_bad, outputs=outputs, inputs=[model1, model2, useridstate])
 
1524
  # ddb = gr.Button("Delete DB")
1525
  # ddb.click(del_db, inputs=dbtext, outputs=ddb)
1526
  # Blur cached sample text so the voting user picks up mispronouncements
1527
+ with gr.Blocks(theme=theme, css="footer {visibility: hidden}textbox{resize:none} .blurred-text {filter: blur(0.15em);}", head=shortcut_js, title="TTS Arena") as demo:
1528
  gr.Markdown(DESCR)
1529
  # gr.TabbedInterface([vote, leaderboard, about, admin], ['Vote', 'Leaderboard', 'About', 'Admin (ONLY IN BETA)'])
1530
  gr.TabbedInterface([vote, leaderboard, about], ['πŸ—³οΈ Vote', 'πŸ† Leaderboard', 'πŸ“„ About'])