Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -93,13 +93,21 @@ with gr.Blocks(title="Multi-Model LLM Chatbot with Image Generation") as demo:
|
|
| 93 |
submit_button = gr.Button("Enviar")
|
| 94 |
|
| 95 |
# Define la funci贸n de actualizaci贸n
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 103 |
|
| 104 |
# Conecta la funci贸n a los componentes
|
| 105 |
submit_button.click(
|
|
|
|
| 93 |
submit_button = gr.Button("Enviar")
|
| 94 |
|
| 95 |
# Define la funci贸n de actualizaci贸n
|
| 96 |
+
def process_input(selected_action, user_input):
|
| 97 |
+
if selected_action == "Generaci贸n de Im谩genes":
|
| 98 |
+
# Manejamos el generador de progreso
|
| 99 |
+
progress_generator = generate_image_with_progress(user_input)
|
| 100 |
+
last_status = None
|
| 101 |
+
last_image = None
|
| 102 |
+
for status, image in progress_generator:
|
| 103 |
+
last_status = status
|
| 104 |
+
last_image = image
|
| 105 |
+
return last_status, last_image
|
| 106 |
+
else:
|
| 107 |
+
model_handler.switch_model(selected_action)
|
| 108 |
+
response = model_handler.generate_response(user_input)
|
| 109 |
+
return response, None
|
| 110 |
+
|
| 111 |
|
| 112 |
# Conecta la funci贸n a los componentes
|
| 113 |
submit_button.click(
|