mrfakename commited on
Commit
1ba9e48
1 Parent(s): 5c02356

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -27
app.py CHANGED
@@ -396,19 +396,16 @@ 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
- def get_txtbox(value, visible=False):
400
- return gr.Textbox(interactive=False, show_label=False, container=False, value=value, lines=1, max_lines=1, visible=visible)
401
- def get_audio(value=None, visible=False):
402
- return gr.Audio(value=value, interactive=False, show_label=False, show_download_button=False, show_share_button=False, waveform_options={'waveform_progress_color': '#3C82F6'}, visible=visible)
403
  def makevisible(text):
404
- print(text)
405
  return (
406
- 'None', # model1
407
- 'None', # model2
408
- get_txtbox('Vote to reveal model A', True), # prevmodel1
409
- get_audio(visible=True), # aud1
410
- get_txtbox('Vote to reveal model B', True), # prevmodel2
411
- get_audio(visible=True), # aud2
 
 
412
  )
413
  with gr.Blocks() as vote:
414
  useridstate = gr.State()
@@ -416,31 +413,25 @@ with gr.Blocks() as vote:
416
  with gr.Group():
417
  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.")
418
  btn = gr.Button("Synthesize", variant='primary')
419
- with gr.Row(visible=False):
420
  gr.HTML('<div align="left"><h3>Model A</h3></div>')
421
  gr.HTML('<div align="right"><h3>Model B</h3></div>')
422
- model1 = gr.Textbox(interactive=False, visible=False, lines=1, max_lines=1)
423
- model2 = gr.Textbox(interactive=False, visible=False, lines=1, max_lines=1)
424
- with gr.Group(visible=False):
425
  with gr.Row():
426
  with gr.Column():
427
  with gr.Group():
428
- # prevmodel1 = gr.Textbox(interactive=False, show_label=False, container=False, value="Vote to reveal model A", lines=1, max_lines=1)
429
- prevmodel1 = get_txtbox('Vote to reveal model A')
430
- aud1 = get_audio()
431
- # aud1 = gr.Audio(interactive=False, show_label=False, show_download_button=False, show_share_button=False, waveform_options={'waveform_progress_color': '#3C82F6'})
432
  with gr.Column():
433
  with gr.Group():
434
- # prevmodel2 = gr.Textbox(interactive=False, show_label=False, container=False, value="Vote to reveal model B", text_align="right", lines=1, max_lines=1)
435
- prevmodel2 = get_txtbox('Vote to reveal model B')
436
- aud2 = get_audio()
437
- # aud2 = gr.Audio(interactive=False, show_label=False, show_download_button=False, show_share_button=False, waveform_options={'waveform_progress_color': '#3C82F6'})
438
- with gr.Row(visible=False):
439
  abetter = gr.Button("A is Better", variant='primary')
440
  bbetter = gr.Button("B is Better", variant='primary')
441
- btn.click(makevisible, inputs=text, outputs=[
442
- model1, model2, prevmodel1, aud1, prevmodel2, aud2,
443
- ])
444
 
445
  # outputs = [aud1, aud2, model1, model2, useridstate, prevmodel1, prevmodel2]
446
  # abetter.click(a_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
+ gr.update(visible=True), # r1
402
+ gr.update(visible=True), # r2
403
+ None, # model1
404
+ None, # model2
405
+ 'Hi', # prevmodel1
406
+ None, # aud1
407
+ 'Hi', # prevmodel2
408
+ None, # aud2
409
  )
410
  with gr.Blocks() as vote:
411
  useridstate = gr.State()
 
413
  with gr.Group():
414
  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.")
415
  btn = gr.Button("Synthesize", variant='primary')
416
+ with gr.Row(visible=False) as r1:
417
  gr.HTML('<div align="left"><h3>Model A</h3></div>')
418
  gr.HTML('<div align="right"><h3>Model B</h3></div>')
419
+ model1 = gr.Textbox(interactive=False, lines=1, max_lines=1, visible=False)
420
+ model2 = gr.Textbox(interactive=False, lines=1, max_lines=1, visible=False)
421
+ with gr.Group(visible=False) as r2:
422
  with gr.Row():
423
  with gr.Column():
424
  with gr.Group():
425
+ prevmodel1 = gr.Textbox(interactive=False, show_label=False, container=False, value="Vote to reveal model A", lines=1, max_lines=1)
426
+ aud1 = gr.Audio(interactive=False, show_label=False, show_download_button=False, show_share_button=False, waveform_options={'waveform_progress_color': '#3C82F6'})
 
 
427
  with gr.Column():
428
  with gr.Group():
429
+ prevmodel2 = gr.Textbox(interactive=False, show_label=False, container=False, value="Vote to reveal model B", text_align="right", lines=1, max_lines=1)
430
+ aud2 = gr.Audio(interactive=False, show_label=False, show_download_button=False, show_share_button=False, waveform_options={'waveform_progress_color': '#3C82F6'})
431
+ with gr.Row():
 
 
432
  abetter = gr.Button("A is Better", variant='primary')
433
  bbetter = gr.Button("B is Better", variant='primary')
434
+ btn.click(makevisible, inputs=text, outputs=[r1, r2, model1, model2, prevmodel1, aud1, prevmodel2, aud2])
 
 
435
 
436
  # outputs = [aud1, aud2, model1, model2, useridstate, prevmodel1, prevmodel2]
437
  # abetter.click(a_is_better, outputs=outputs, inputs=[model1, model2, useridstate])