TaliDror commited on
Commit
040c3c5
·
1 Parent(s): f6b96fc

improved UI

Browse files
Files changed (1) hide show
  1. app.py +11 -5
app.py CHANGED
@@ -527,10 +527,15 @@ def build_demo():
527
 
528
  with gr.Row():
529
  with gr.Column():
530
- audio_input = gr.Audio(
531
- sources=["upload", "microphone"],
532
  type="filepath",
533
- label="Audio Input",
 
 
 
 
 
534
  )
535
  generate_btn = gr.Button("Generate", variant="primary")
536
 
@@ -538,14 +543,15 @@ def build_demo():
538
  gallery = gr.Gallery(label="Generated Images")
539
  status = gr.Markdown(visible=False)
540
 
541
- def _generate(audio):
 
542
  imgs, msg = generate(audio, DEFAULT_NUM_DISPLAY, DEFAULT_GUIDANCE_SCALE, DEFAULT_NUM_STEPS, DEFAULT_BASE_SEED)
543
  visible = bool(msg)
544
  return imgs, gr.update(value=msg, visible=visible)
545
 
546
  generate_btn.click(
547
  fn=_generate,
548
- inputs=[audio_input],
549
  outputs=[gallery, status],
550
  )
551
 
 
527
 
528
  with gr.Row():
529
  with gr.Column():
530
+ audio_upload = gr.Audio(
531
+ sources=["upload"],
532
  type="filepath",
533
+ label="Upload Audio",
534
+ )
535
+ audio_mic = gr.Audio(
536
+ sources=["microphone"],
537
+ type="filepath",
538
+ label="Record Audio",
539
  )
540
  generate_btn = gr.Button("Generate", variant="primary")
541
 
 
543
  gallery = gr.Gallery(label="Generated Images")
544
  status = gr.Markdown(visible=False)
545
 
546
+ def _generate(upload, mic):
547
+ audio = upload if upload is not None else mic
548
  imgs, msg = generate(audio, DEFAULT_NUM_DISPLAY, DEFAULT_GUIDANCE_SCALE, DEFAULT_NUM_STEPS, DEFAULT_BASE_SEED)
549
  visible = bool(msg)
550
  return imgs, gr.update(value=msg, visible=visible)
551
 
552
  generate_btn.click(
553
  fn=_generate,
554
+ inputs=[audio_upload, audio_mic],
555
  outputs=[gallery, status],
556
  )
557