Update app.py
Browse files
app.py
CHANGED
|
@@ -226,7 +226,7 @@ def set_gender_prompt(gender):
|
|
| 226 |
return f"A photo of a {gender} img"
|
| 227 |
|
| 228 |
|
| 229 |
-
|
| 230 |
"Garden":"Photo of a man img, realistic eyes, natural skin, no hands. The model wears a light cream linen shirt with beige trousers, standing in a bloomed garden, with a romantic vibe.",
|
| 231 |
"Balcony":"Photo of a man img, realistic eyes, natural skin, no hands. The model wears a tailored evening suit, standing on a balcony with an elegant vibe.",
|
| 232 |
"Park":"Photo of a man img, realistic eyes, natural skin, no hands. The model wears a fitted athletic T-shirt and joggers, posing in a park with an energetic vibe.",
|
|
@@ -247,7 +247,7 @@ man_prompts_dict = {
|
|
| 247 |
}
|
| 248 |
|
| 249 |
|
| 250 |
-
|
| 251 |
"Garden":"Photo of a woman img, realistic eyes, natural skin, no hands. The model wears a floral maxi dress, standing in a bloomed garden, with a romantic vibe.",
|
| 252 |
"Balcony":"Photo of a woman img, realistic eyes, natural skin, no hands. The model wears an evening gown, standing on a balcony with an elegant vibe.",
|
| 253 |
"Park":"Photo of a woman img, realistic eyes, natural skin, no hands. The model wears a sporty crop top and leggings, posing in a park with an energetic vibe.",
|
|
@@ -270,10 +270,7 @@ woman_prompts_dict = {
|
|
| 270 |
|
| 271 |
|
| 272 |
def get_prompts_by_gender(gender):
|
| 273 |
-
if gender == "man"
|
| 274 |
-
return man_prompts_dict
|
| 275 |
-
else:
|
| 276 |
-
return woman_prompts_dict
|
| 277 |
|
| 278 |
def update_suggestion_buttons(gender):
|
| 279 |
prompts = get_prompts_by_gender(gender)
|
|
@@ -468,10 +465,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 |
-
|
| 472 |
-
|
| 473 |
-
|
| 474 |
-
|
| 475 |
# prompt_buttons = []
|
| 476 |
# for s in suggestions:
|
| 477 |
# b = gr.Button(s)
|
|
@@ -646,20 +642,10 @@ with gr.Blocks(css=css) as demo:
|
|
| 646 |
# )
|
| 647 |
|
| 648 |
# When user clicks on a suggestion, fill the prompt textbox and close popup
|
| 649 |
-
for theme,
|
| 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=
|
| 663 |
inputs=None,
|
| 664 |
outputs=[prompt, prompt_suggestions]
|
| 665 |
)
|
|
@@ -668,6 +654,7 @@ with gr.Blocks(css=css) as demo:
|
|
| 668 |
|
| 669 |
|
| 670 |
|
|
|
|
| 671 |
# gr.Examples(
|
| 672 |
# examples=get_example(),
|
| 673 |
# inputs=[files, prompt, style, negative_prompt],
|
|
|
|
| 226 |
return f"A photo of a {gender} img"
|
| 227 |
|
| 228 |
|
| 229 |
+
man_prompts = {
|
| 230 |
"Garden":"Photo of a man img, realistic eyes, natural skin, no hands. The model wears a light cream linen shirt with beige trousers, standing in a bloomed garden, with a romantic vibe.",
|
| 231 |
"Balcony":"Photo of a man img, realistic eyes, natural skin, no hands. The model wears a tailored evening suit, standing on a balcony with an elegant vibe.",
|
| 232 |
"Park":"Photo of a man img, realistic eyes, natural skin, no hands. The model wears a fitted athletic T-shirt and joggers, posing in a park with an energetic vibe.",
|
|
|
|
| 247 |
}
|
| 248 |
|
| 249 |
|
| 250 |
+
woman_prompts = {
|
| 251 |
"Garden":"Photo of a woman img, realistic eyes, natural skin, no hands. The model wears a floral maxi dress, standing in a bloomed garden, with a romantic vibe.",
|
| 252 |
"Balcony":"Photo of a woman img, realistic eyes, natural skin, no hands. The model wears an evening gown, standing on a balcony with an elegant vibe.",
|
| 253 |
"Park":"Photo of a woman img, realistic eyes, natural skin, no hands. The model wears a sporty crop top and leggings, posing in a park with an energetic vibe.",
|
|
|
|
| 270 |
|
| 271 |
|
| 272 |
def get_prompts_by_gender(gender):
|
| 273 |
+
return man_prompts if gender == "man" else woman_prompts
|
|
|
|
|
|
|
|
|
|
| 274 |
|
| 275 |
def update_suggestion_buttons(gender):
|
| 276 |
prompts = get_prompts_by_gender(gender)
|
|
|
|
| 465 |
with gr.Group(visible=False, elem_id="prompt_suggestions_box") as prompt_suggestions:
|
| 466 |
gr.Markdown("### Suggested Prompts")
|
| 467 |
|
| 468 |
+
theme_buttons = []
|
| 469 |
+
for theme in man_prompts.keys(): # initially load man themes
|
| 470 |
+
theme_buttons.append(gr.Button(theme))
|
|
|
|
| 471 |
# prompt_buttons = []
|
| 472 |
# for s in suggestions:
|
| 473 |
# b = gr.Button(s)
|
|
|
|
| 642 |
# )
|
| 643 |
|
| 644 |
# When user clicks on a suggestion, fill the prompt textbox and close popup
|
| 645 |
+
for theme, prompt_text in man_prompts.items():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 646 |
b = gr.Button(theme)
|
|
|
|
| 647 |
b.click(
|
| 648 |
+
fn=lambda _, t=prompt_text: (gr.update(value=t), gr.update(visible=False)),
|
| 649 |
inputs=None,
|
| 650 |
outputs=[prompt, prompt_suggestions]
|
| 651 |
)
|
|
|
|
| 654 |
|
| 655 |
|
| 656 |
|
| 657 |
+
|
| 658 |
# gr.Examples(
|
| 659 |
# examples=get_example(),
|
| 660 |
# inputs=[files, prompt, style, negative_prompt],
|