Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -492,7 +492,12 @@ with gr.Blocks(title="Image Character Persona Generator") as iface:
|
|
| 492 |
# Function to use the current persona in chat
|
| 493 |
def use_persona_in_chat(persona):
|
| 494 |
return persona
|
| 495 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 496 |
# Connect the UI elements with their functions
|
| 497 |
refresh_gallery_btn.click(
|
| 498 |
fn=refresh_character_gallery,
|
|
@@ -547,6 +552,13 @@ with gr.Blocks(title="Image Character Persona Generator") as iface:
|
|
| 547 |
outputs=[system_prompt]
|
| 548 |
)
|
| 549 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 550 |
# Initialize the profiles dropdown and character gallery
|
| 551 |
iface.load(
|
| 552 |
fn=lambda: (refresh_profiles_list, refresh_character_gallery),
|
|
|
|
| 492 |
# Function to use the current persona in chat
|
| 493 |
def use_persona_in_chat(persona):
|
| 494 |
return persona
|
| 495 |
+
|
| 496 |
+
def initialize_interface(profiles_data):
|
| 497 |
+
profiles_list = refresh_profiles_list(profiles_data)
|
| 498 |
+
gallery = refresh_character_gallery()
|
| 499 |
+
return profiles_list, gallery
|
| 500 |
+
|
| 501 |
# Connect the UI elements with their functions
|
| 502 |
refresh_gallery_btn.click(
|
| 503 |
fn=refresh_character_gallery,
|
|
|
|
| 552 |
outputs=[system_prompt]
|
| 553 |
)
|
| 554 |
|
| 555 |
+
# Then use it:
|
| 556 |
+
iface.load(
|
| 557 |
+
fn=initialize_interface,
|
| 558 |
+
inputs=[profiles_state],
|
| 559 |
+
outputs=[profile_dropdown, character_gallery]
|
| 560 |
+
)
|
| 561 |
+
|
| 562 |
# Initialize the profiles dropdown and character gallery
|
| 563 |
iface.load(
|
| 564 |
fn=lambda: (refresh_profiles_list, refresh_character_gallery),
|