mrfakename commited on
Commit
89d563e
1 Parent(s): 7366b46
Files changed (1) hide show
  1. app.py +21 -11
app.py CHANGED
@@ -396,18 +396,30 @@ with gr.Blocks() as leaderboard:
396
  # bothgood.click(both_good, outputs=outputs, inputs=[model1, model2, useridstate])
397
 
398
  # vote.load(reload, outputs=[aud1, aud2, model1, model2])
 
 
 
 
 
 
 
 
 
 
 
 
 
399
  with gr.Blocks() as vote:
400
  useridstate = gr.State()
401
  gr.Markdown(INSTR)
402
  with gr.Group():
403
  text = gr.Textbox(label="Enter text to synthesize", info="By entering text, you certify that it is either in the public domain or, if you are its author, you dedicate it into the public domain. You also must agree to the privacy statement in the About page.")
404
  btn = gr.Button("Synthesize", variant='primary')
405
- with gr.Row():
406
  gr.HTML('<div align="left"><h3>Model A</h3></div>')
407
  gr.HTML('<div align="right"><h3>Model B</h3></div>')
408
  model1 = gr.Textbox(interactive=False, visible=False, lines=1, max_lines=1)
409
  model2 = gr.Textbox(interactive=False, visible=False, lines=1, max_lines=1)
410
-
411
  with gr.Group(visible=False):
412
  with gr.Row():
413
  with gr.Column():
@@ -418,16 +430,14 @@ with gr.Blocks() as vote:
418
  with gr.Group():
419
  prevmodel2 = gr.Textbox(interactive=False, show_label=False, container=False, value="Vote to reveal model B", text_align="right", lines=1, max_lines=1)
420
  aud2 = gr.Audio(interactive=False, show_label=False, show_download_button=False, show_share_button=False, waveform_options={'waveform_progress_color': '#3C82F6'})
 
 
 
 
 
 
 
421
 
422
-
423
- with gr.Row(visible=False):
424
- abetter = gr.Button("A is Better", variant='primary', scale=4)
425
- # skipbtn = gr.Button("Skip", scale=1)
426
- bbetter = gr.Button("B is Better", variant='primary', scale=4)
427
- with gr.Row(visible=False):
428
- bothbad = gr.Button("Both are Bad", scale=2)
429
- skipbtn = gr.Button("Skip", scale=1)
430
- bothgood = gr.Button("Both are Good", scale=2)
431
  # outputs = [aud1, aud2, model1, model2, useridstate, prevmodel1, prevmodel2]
432
  # abetter.click(a_is_better, outputs=outputs, inputs=[model1, model2, useridstate])
433
  # bbetter.click(b_is_better, outputs=outputs, inputs=[model1, model2, useridstate])
 
396
  # bothgood.click(both_good, outputs=outputs, inputs=[model1, model2, useridstate])
397
 
398
  # vote.load(reload, outputs=[aud1, aud2, model1, model2])
399
+ def makevisible(text):
400
+ return (
401
+ None, # model1
402
+ None, # model2
403
+ gr.update(visible=True), # prevmodel1
404
+ gr.update(visible=True), # aud1
405
+ gr.update(visible=True), # prevmodel2
406
+ gr.update(visible=True), # aud2
407
+ 'Test',
408
+ None,
409
+ 'Test',
410
+ None,
411
+ )
412
  with gr.Blocks() as vote:
413
  useridstate = gr.State()
414
  gr.Markdown(INSTR)
415
  with gr.Group():
416
  text = gr.Textbox(label="Enter text to synthesize", info="By entering text, you certify that it is either in the public domain or, if you are its author, you dedicate it into the public domain. You also must agree to the privacy statement in the About page.")
417
  btn = gr.Button("Synthesize", variant='primary')
418
+ with gr.Row(visible=False):
419
  gr.HTML('<div align="left"><h3>Model A</h3></div>')
420
  gr.HTML('<div align="right"><h3>Model B</h3></div>')
421
  model1 = gr.Textbox(interactive=False, visible=False, lines=1, max_lines=1)
422
  model2 = gr.Textbox(interactive=False, visible=False, lines=1, max_lines=1)
 
423
  with gr.Group(visible=False):
424
  with gr.Row():
425
  with gr.Column():
 
430
  with gr.Group():
431
  prevmodel2 = gr.Textbox(interactive=False, show_label=False, container=False, value="Vote to reveal model B", text_align="right", lines=1, max_lines=1)
432
  aud2 = gr.Audio(interactive=False, show_label=False, show_download_button=False, show_share_button=False, waveform_options={'waveform_progress_color': '#3C82F6'})
433
+ with gr.Row(visible=False):
434
+ abetter = gr.Button("A is Better", variant='primary')
435
+ bbetter = gr.Button("B is Better", variant='primary')
436
+ btn.click(makevisible, inputs=text, outputs=[
437
+ model1, model2, prevmodel1, aud1, prevmodel2, aud2,
438
+ prevmodel1, aud1, prevmodel2, aud2
439
+ ])
440
 
 
 
 
 
 
 
 
 
 
441
  # outputs = [aud1, aud2, model1, model2, useridstate, prevmodel1, prevmodel2]
442
  # abetter.click(a_is_better, outputs=outputs, inputs=[model1, model2, useridstate])
443
  # bbetter.click(b_is_better, outputs=outputs, inputs=[model1, model2, useridstate])