TaliDror commited on
Commit
0362643
·
1 Parent(s): 5139313

improved UI

Browse files
Files changed (1) hide show
  1. app.py +11 -3
app.py CHANGED
@@ -516,8 +516,10 @@ def build_demo():
516
  gr.Markdown("# AAS2F: Ambiguity-Aware Speech-to-Face Synthesis with Speaker-Conditioned Diffusion Models")
517
  gr.Markdown(
518
  "**Steps to use the demo:**\n\n"
519
- "1. Upload or record a speech audio clip to generate face images conditioned on the speaker's voice. **Please provide at least 5 seconds of speech.** Note that it works best with **English** as the model is trained on English speech, but should work with other languages as well.\n"
520
- "2. Click the 'Generate' button to start the generation process."
 
 
521
  )
522
 
523
  DEFAULT_NUM_DISPLAY = 3
@@ -538,12 +540,18 @@ def build_demo():
538
  type="filepath",
539
  label="Record Audio",
540
  )
541
- generate_btn = gr.Button("Generate", variant="primary")
542
 
543
  with gr.Column():
544
  gallery = gr.Gallery(label="Generated Images")
545
  status = gr.Markdown(visible=False)
546
 
 
 
 
 
 
 
547
  def _generate(upload, mic):
548
  audio = upload if upload is not None else mic
549
  imgs, msg = generate(audio, DEFAULT_NUM_DISPLAY, DEFAULT_GUIDANCE_SCALE, DEFAULT_NUM_STEPS, DEFAULT_BASE_SEED)
 
516
  gr.Markdown("# AAS2F: Ambiguity-Aware Speech-to-Face Synthesis with Speaker-Conditioned Diffusion Models")
517
  gr.Markdown(
518
  "**Steps to use the demo:**\n\n"
519
+ "1. Upload or record a speech audio clip. **Please provide at least 5 seconds of speech.**\n"
520
+ "2. Note that it works best with **English**, but should work with other languages as well.\n"
521
+ "3. After you are done recording/uploading the audio, click the 'Generate' button to start the generation process.\n"
522
+ "4. After a few seconds, the generated images will be displayed on the right."
523
  )
524
 
525
  DEFAULT_NUM_DISPLAY = 3
 
540
  type="filepath",
541
  label="Record Audio",
542
  )
543
+ generate_btn = gr.Button("Generate", variant="primary", interactive=False)
544
 
545
  with gr.Column():
546
  gallery = gr.Gallery(label="Generated Images")
547
  status = gr.Markdown(visible=False)
548
 
549
+ def _update_btn(upload, mic):
550
+ return gr.update(interactive=(upload is not None or mic is not None))
551
+
552
+ audio_upload.change(fn=_update_btn, inputs=[audio_upload, audio_mic], outputs=generate_btn)
553
+ audio_mic.change(fn=_update_btn, inputs=[audio_upload, audio_mic], outputs=generate_btn)
554
+
555
  def _generate(upload, mic):
556
  audio = upload if upload is not None else mic
557
  imgs, msg = generate(audio, DEFAULT_NUM_DISPLAY, DEFAULT_GUIDANCE_SCALE, DEFAULT_NUM_STEPS, DEFAULT_BASE_SEED)