Significant commited on
Commit
16983e0
·
verified ·
1 Parent(s): 25bee8e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -18
app.py CHANGED
@@ -468,22 +468,9 @@ with gr.Blocks(css=css) as demo:
468
  with gr.Group(visible=False, elem_id="prompt_suggestions_box") as prompt_suggestions:
469
  gr.Markdown("### Suggested Prompts")
470
 
471
- man_btns = [
472
- gr.Button(s) for s in [
473
- "A portrait of a man img in cinematic lighting",
474
- "A stylish man img in a business suit",
475
- "A close-up photo of a man img in natural light"
476
-
477
- ]
478
- ]
479
 
480
- woman_btns = [
481
- gr.Button(s) for s in [
482
- "A photo of a smiling woman img in a sunny park",
483
- "A studio photo of a woman img wearing glasses",
484
- "A glamorous portrait of a woman img with dramatic lighting"
485
- ]
486
- ]
487
 
488
  # prompt_buttons = []
489
  # for s in suggestions:
@@ -659,13 +646,24 @@ with gr.Blocks(css=css) as demo:
659
  # )
660
 
661
  # When user clicks on a suggestion, fill the prompt textbox and close popup
662
- for b in man_btns + woman_btns:
663
- text = b.value # capture current button text
 
664
  b.click(
665
- fn=lambda _, t=text: (gr.update(value=t), gr.update(visible=False)),
666
  inputs=None,
667
  outputs=[prompt, prompt_suggestions]
668
  )
 
 
 
 
 
 
 
 
 
 
669
 
670
 
671
 
 
468
  with gr.Group(visible=False, elem_id="prompt_suggestions_box") as prompt_suggestions:
469
  gr.Markdown("### Suggested Prompts")
470
 
471
+ man_btns = [gr.Button(theme) for theme in man_prompts_dict.keys()]
 
 
 
 
 
 
 
472
 
473
+ woman_btns = [gr.Button(theme) for theme in woman_prompts_dict.keys()]
 
 
 
 
 
 
474
 
475
  # prompt_buttons = []
476
  # for s in suggestions:
 
646
  # )
647
 
648
  # When user clicks on a suggestion, fill the prompt textbox and close popup
649
+ for theme, text in man_prompts_dict.items():
650
+ b = gr.Button(theme)
651
+ man_btns.append(b)
652
  b.click(
653
+ fn=lambda t=text: (gr.update(value=t), gr.update(visible=False)),
654
  inputs=None,
655
  outputs=[prompt, prompt_suggestions]
656
  )
657
+
658
+ for theme, text in woman_prompts_dict.items():
659
+ b = gr.Button(theme)
660
+ woman_btns.append(b)
661
+ b.click(
662
+ fn=lambda t=text: (gr.update(value=t), gr.update(visible=False)),
663
+ inputs=None,
664
+ outputs=[prompt, prompt_suggestions]
665
+ )
666
+
667
 
668
 
669