mrfakename commited on
Commit
52fc37b
1 Parent(s): f29be9c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -11
app.py CHANGED
@@ -35,7 +35,6 @@ AVAILABLE_MODELS = {
35
  'WhisperSpeech': 'whisperspeech',
36
  'ElevenLabs': 'eleven',
37
  'OpenVoice': 'openvoice',
38
- 'Pheme': 'pheme',
39
  'MetaVoice': 'metavoice',
40
  'MeloTTS': 'melo',
41
  'StyleTTS 2': 'styletts2',
@@ -633,8 +632,8 @@ def synthandreturn(text):
633
  gr.update(visible=False), #prevmodel2
634
  gr.update(visible=False), #nxt round btn
635
  # reset aplayed, bplayed audio playback events
636
- gr.update(value=False), #aplayed
637
- gr.update(value=False), #bplayed
638
  )
639
  # return (
640
  # text,
@@ -686,8 +685,8 @@ def enable():
686
  return [gr.update(interactive=True), gr.update(interactive=True), gr.update(interactive=True)]
687
  with gr.Blocks() as vote:
688
  # sample played
689
- aplayed = gr.State(value=False)
690
- bplayed = gr.State(value=False)
691
  # voter ID
692
  useridstate = gr.State()
693
  gr.Markdown(INSTR)
@@ -703,22 +702,22 @@ with gr.Blocks() as vote:
703
  with gr.Column():
704
  with gr.Group():
705
  aud1 = gr.Audio(interactive=False, show_label=False, show_download_button=False, show_share_button=False, waveform_options={'waveform_progress_color': '#3C82F6'})
706
- abetter = gr.Button("A is better", variant='primary', interactive=False)
707
  prevmodel1 = gr.Textbox(interactive=False, show_label=False, container=False, value="Vote to reveal model A", text_align="center", lines=1, max_lines=1, visible=False)
708
  with gr.Column():
709
  with gr.Group():
710
  aud2 = gr.Audio(interactive=False, show_label=False, show_download_button=False, show_share_button=False, waveform_options={'waveform_progress_color': '#3C82F6'})
711
- bbetter = gr.Button("B is better", variant='primary', interactive=False)
712
  prevmodel2 = gr.Textbox(interactive=False, show_label=False, container=False, value="Vote to reveal model B", text_align="center", lines=1, max_lines=1, visible=False)
713
  nxtroundbtn = gr.Button('Next round', visible=False)
714
  # outputs = [text, btn, r2, model1, model2, prevmodel1, aud1, prevmodel2, aud2, abetter, bbetter]
715
- outputs = [text, btn, r2, model1, model2, aud1, aud2, abetter, bbetter, prevmodel1, prevmodel2, nxtroundbtn, aplayed, bplayed]
716
- btn.click(disable, outputs=[btn, abetter, bbetter]).then(synthandreturn, inputs=[text], outputs=outputs).then(enable, outputs=[btn, gr.State(), gr.State()])
717
  nxtroundbtn.click(clear_stuff, outputs=outputs)
718
 
719
  # Allow interaction with the vote buttons only when both audio samples have finished playing
720
- aud1.stop(unlock_vote, outputs=[abetter, bbetter, aplayed, bplayed], inputs=[gr.State(value=0), aplayed, bplayed])
721
- aud2.stop(unlock_vote, outputs=[abetter, bbetter, aplayed, bplayed], inputs=[gr.State(value=1), aplayed, bplayed])
722
 
723
  # nxt_outputs = [prevmodel1, prevmodel2, abetter, bbetter]
724
  nxt_outputs = [abetter, bbetter, prevmodel1, prevmodel2, nxtroundbtn]
 
35
  'WhisperSpeech': 'whisperspeech',
36
  'ElevenLabs': 'eleven',
37
  'OpenVoice': 'openvoice',
 
38
  'MetaVoice': 'metavoice',
39
  'MeloTTS': 'melo',
40
  'StyleTTS 2': 'styletts2',
 
632
  gr.update(visible=False), #prevmodel2
633
  gr.update(visible=False), #nxt round btn
634
  # reset aplayed, bplayed audio playback events
635
+ #gr.update(value=False), #aplayed
636
+ #r.update(value=False), #bplayed
637
  )
638
  # return (
639
  # text,
 
685
  return [gr.update(interactive=True), gr.update(interactive=True), gr.update(interactive=True)]
686
  with gr.Blocks() as vote:
687
  # sample played
688
+ #aplayed = gr.State(value=False)
689
+ #bplayed = gr.State(value=False)
690
  # voter ID
691
  useridstate = gr.State()
692
  gr.Markdown(INSTR)
 
702
  with gr.Column():
703
  with gr.Group():
704
  aud1 = gr.Audio(interactive=False, show_label=False, show_download_button=False, show_share_button=False, waveform_options={'waveform_progress_color': '#3C82F6'})
705
+ abetter = gr.Button("A is better", variant='primary')
706
  prevmodel1 = gr.Textbox(interactive=False, show_label=False, container=False, value="Vote to reveal model A", text_align="center", lines=1, max_lines=1, visible=False)
707
  with gr.Column():
708
  with gr.Group():
709
  aud2 = gr.Audio(interactive=False, show_label=False, show_download_button=False, show_share_button=False, waveform_options={'waveform_progress_color': '#3C82F6'})
710
+ bbetter = gr.Button("B is better", variant='primary')
711
  prevmodel2 = gr.Textbox(interactive=False, show_label=False, container=False, value="Vote to reveal model B", text_align="center", lines=1, max_lines=1, visible=False)
712
  nxtroundbtn = gr.Button('Next round', visible=False)
713
  # outputs = [text, btn, r2, model1, model2, prevmodel1, aud1, prevmodel2, aud2, abetter, bbetter]
714
+ outputs = [text, btn, r2, model1, model2, aud1, aud2, abetter, bbetter, prevmodel1, prevmodel2, nxtroundbtn]
715
+ btn.click(disable, outputs=[btn, abetter, bbetter]).then(synthandreturn, inputs=[text], outputs=outputs).then(enable, outputs=[btn])
716
  nxtroundbtn.click(clear_stuff, outputs=outputs)
717
 
718
  # Allow interaction with the vote buttons only when both audio samples have finished playing
719
+ #aud1.stop(unlock_vote, outputs=[abetter, bbetter, aplayed, bplayed], inputs=[gr.State(value=0), aplayed, bplayed])
720
+ #aud2.stop(unlock_vote, outputs=[abetter, bbetter, aplayed, bplayed], inputs=[gr.State(value=1), aplayed, bplayed])
721
 
722
  # nxt_outputs = [prevmodel1, prevmodel2, abetter, bbetter]
723
  nxt_outputs = [abetter, bbetter, prevmodel1, prevmodel2, nxtroundbtn]