Update app.py
Browse files
app.py
CHANGED
|
@@ -465,20 +465,25 @@ with gr.Blocks(css=css) as demo:
|
|
| 465 |
outputs=prompt_suggestions
|
| 466 |
)
|
| 467 |
|
| 468 |
-
def
|
| 469 |
updates = update_prompt_buttons_visibility(gender)
|
| 470 |
# Force popup to remain hidden
|
| 471 |
updates[0] = gr.update(visible=False)
|
| 472 |
return updates
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 473 |
|
| 474 |
gender_selector.change(
|
| 475 |
-
fn=
|
| 476 |
inputs=gender_selector,
|
| 477 |
outputs=[prompt_suggestions] + man_btns + woman_btns
|
| 478 |
)
|
| 479 |
|
| 480 |
show_prompts_btn.click(
|
| 481 |
-
fn=
|
| 482 |
inputs=gender_selector,
|
| 483 |
outputs=[prompt_suggestions] + man_btns + woman_btns
|
| 484 |
)
|
|
|
|
| 465 |
outputs=prompt_suggestions
|
| 466 |
)
|
| 467 |
|
| 468 |
+
def update_buttons_hidden(gender):
|
| 469 |
updates = update_prompt_buttons_visibility(gender)
|
| 470 |
# Force popup to remain hidden
|
| 471 |
updates[0] = gr.update(visible=False)
|
| 472 |
return updates
|
| 473 |
+
|
| 474 |
+
def update_buttons_and_show(gender):
|
| 475 |
+
updates = update_prompt_buttons_visibility(gender)
|
| 476 |
+
updates[0] = gr.update(visible=True) # force popup visible
|
| 477 |
+
return updates
|
| 478 |
|
| 479 |
gender_selector.change(
|
| 480 |
+
fn=update_buttons_hidden,
|
| 481 |
inputs=gender_selector,
|
| 482 |
outputs=[prompt_suggestions] + man_btns + woman_btns
|
| 483 |
)
|
| 484 |
|
| 485 |
show_prompts_btn.click(
|
| 486 |
+
fn=update_buttons_and_show,
|
| 487 |
inputs=gender_selector,
|
| 488 |
outputs=[prompt_suggestions] + man_btns + woman_btns
|
| 489 |
)
|