Pendrokar commited on
Commit
1eae8c6
β€’
1 Parent(s): cc70457

pin space; unblur text using JS

Browse files
Files changed (2) hide show
  1. README.md +1 -1
  2. app.py +16 -6
README.md CHANGED
@@ -8,7 +8,7 @@ tags:
8
  emoji: πŸ€—πŸ†
9
  colorFrom: red
10
  colorTo: red
11
- pinned: false
12
  short_description: Vote on the top HF TTS models!
13
  models:
14
  - coqui/XTTS-v2
 
8
  emoji: πŸ€—πŸ†
9
  colorFrom: red
10
  colorTo: red
11
+ pinned: true
12
  short_description: Vote on the top HF TTS models!
13
  models:
14
  - coqui/XTTS-v2
app.py CHANGED
@@ -1264,6 +1264,8 @@ def enable():
1264
  def unblur_text():
1265
  return gr.update(elem_classes=[])
1266
 
 
 
1267
  with gr.Blocks() as vote:
1268
  session_hash = gr.Textbox(visible=False, value='')
1269
 
@@ -1276,16 +1278,24 @@ with gr.Blocks() as vote:
1276
  with gr.Group():
1277
  with gr.Row():
1278
  cachedt = gr.Button('⚑', scale=0, min_width=0, variant='tool', interactive=True)
1279
- text = gr.Textbox(container=False, show_label=False, placeholder="Enter text to synthesize", lines=1, max_lines=1, scale=9999999, min_width=0)
 
 
 
 
 
 
 
 
 
 
1280
  randomt = gr.Button('🎲', scale=0, min_width=0, variant='tool')
1281
  randomt\
1282
  .click(randomsent, outputs=[cachedt, text, randomt])\
1283
- .then(unblur_text, outputs=text)
1284
  btn = gr.Button("Synthesize", variant='primary')
1285
  model1 = gr.Textbox(interactive=False, lines=1, max_lines=1, visible=False)
1286
- #model1 = gr.Textbox(interactive=False, lines=1, max_lines=1, visible=True)
1287
  model2 = gr.Textbox(interactive=False, lines=1, max_lines=1, visible=False)
1288
- #model2 = gr.Textbox(interactive=False, lines=1, max_lines=1, visible=True)
1289
  with gr.Row(visible=False) as r2:
1290
  with gr.Column():
1291
  with gr.Group():
@@ -1346,7 +1356,7 @@ with gr.Blocks() as vote:
1346
  .click(disable, outputs=[btn, abetter, bbetter, cachedt])\
1347
  .then(synthandreturn, inputs=[text], outputs=outputs)\
1348
  .then(enable, outputs=[btn, gr.State(), gr.State(), cachedt])\
1349
- .then(unblur_text, outputs=text)
1350
  nxtroundbtn\
1351
  .click(disable, outputs=[btn, abetter, bbetter, cachedt])\
1352
  .then(give_cached_sample, inputs=[session_hash], outputs=[*outputs, cachedt])\
@@ -1378,7 +1388,7 @@ with gr.Blocks() as vote:
1378
  outputs=[abetter, bbetter, aplayed, bplayed],
1379
  inputs=[gr.State(value=1), aplayed, bplayed],
1380
  )\
1381
- .then(unblur_text, outputs=text)
1382
  # aud1.input(
1383
  # None,
1384
  # js="() => {console.log(new Date().getTime().toString()+'input')}",
 
1264
  def unblur_text():
1265
  return gr.update(elem_classes=[])
1266
 
1267
+ unblur_js = 'document.getElementById("arena-text-input").classList.remove("blurred-text")'
1268
+
1269
  with gr.Blocks() as vote:
1270
  session_hash = gr.Textbox(visible=False, value='')
1271
 
 
1278
  with gr.Group():
1279
  with gr.Row():
1280
  cachedt = gr.Button('⚑', scale=0, min_width=0, variant='tool', interactive=True)
1281
+ text = gr.Textbox(
1282
+ container=False,
1283
+ show_label=False,
1284
+ placeholder="Enter text to synthesize",
1285
+ lines=1,
1286
+ max_lines=1,
1287
+ scale=9999999,
1288
+ min_width=0,
1289
+ elem_id="arena-text-input",
1290
+ elem_classes="blurred-text",
1291
+ )
1292
  randomt = gr.Button('🎲', scale=0, min_width=0, variant='tool')
1293
  randomt\
1294
  .click(randomsent, outputs=[cachedt, text, randomt])\
1295
+ .then(None, js="() => "+ unblur_js)
1296
  btn = gr.Button("Synthesize", variant='primary')
1297
  model1 = gr.Textbox(interactive=False, lines=1, max_lines=1, visible=False)
 
1298
  model2 = gr.Textbox(interactive=False, lines=1, max_lines=1, visible=False)
 
1299
  with gr.Row(visible=False) as r2:
1300
  with gr.Column():
1301
  with gr.Group():
 
1356
  .click(disable, outputs=[btn, abetter, bbetter, cachedt])\
1357
  .then(synthandreturn, inputs=[text], outputs=outputs)\
1358
  .then(enable, outputs=[btn, gr.State(), gr.State(), cachedt])\
1359
+ .then(None, js="() => "+ unblur_js)
1360
  nxtroundbtn\
1361
  .click(disable, outputs=[btn, abetter, bbetter, cachedt])\
1362
  .then(give_cached_sample, inputs=[session_hash], outputs=[*outputs, cachedt])\
 
1388
  outputs=[abetter, bbetter, aplayed, bplayed],
1389
  inputs=[gr.State(value=1), aplayed, bplayed],
1390
  )\
1391
+ .then(None, js="() => "+ unblur_js)
1392
  # aud1.input(
1393
  # None,
1394
  # js="() => {console.log(new Date().getTime().toString()+'input')}",