Katon1 commited on
Commit
3cd1f5e
verified
1 Parent(s): ca73fe2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -7
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
- def process_input(selected_action, user_input):
97
- if selected_action == "Generaci贸n de Im谩genes":
98
- return generate_image_with_progress(user_input)
99
- else:
100
- model_handler.switch_model(selected_action)
101
- response = model_handler.generate_response(user_input)
102
- return response, None
 
 
 
 
 
 
 
 
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(