Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -77,7 +77,7 @@ def response(message, history):
|
|
77 |
files = message["files"]
|
78 |
|
79 |
# Procesar imágenes cargadas
|
80 |
-
image_prompts = [
|
81 |
if files:
|
82 |
for file in files:
|
83 |
image = Image.open(file).convert('RGB')
|
@@ -95,8 +95,15 @@ def response(message, history):
|
|
95 |
}
|
96 |
image_prompts.append(image_prompt)
|
97 |
|
98 |
-
#
|
99 |
-
prompts = [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
response = chat.send_message(prompts)
|
101 |
response.resolve()
|
102 |
|
|
|
77 |
files = message["files"]
|
78 |
|
79 |
# Procesar imágenes cargadas
|
80 |
+
image_prompts = []
|
81 |
if files:
|
82 |
for file in files:
|
83 |
image = Image.open(file).convert('RGB')
|
|
|
95 |
}
|
96 |
image_prompts.append(image_prompt)
|
97 |
|
98 |
+
# Asegurarse de que el texto y las imágenes estén en el formato correcto
|
99 |
+
prompts = []
|
100 |
+
if text_prompt:
|
101 |
+
prompts.append({"parts": [{"text": text_prompt}], "role": "user"})
|
102 |
+
|
103 |
+
if image_prompts:
|
104 |
+
prompts.extend(image_prompts)
|
105 |
+
|
106 |
+
# Enviar el mensaje al modelo
|
107 |
response = chat.send_message(prompts)
|
108 |
response.resolve()
|
109 |
|