Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -41,7 +41,7 @@ def print_current_selection():
|
|
41 |
print(f"Dimensions: {DIMENSIONS}")
|
42 |
|
43 |
# Establecer el nombre del índice automáticamente
|
44 |
-
INDEX_NAME = '
|
45 |
|
46 |
# Obtener la clave API de Pinecone
|
47 |
#PINECONE_API_KEY = userdata.get('PINECONE_API_KEY')
|
@@ -64,7 +64,7 @@ def connect_to_pinecone(index_name):
|
|
64 |
except Exception as e:
|
65 |
print(f"Failed to connect to Pinecone index '{index_name}':", str(e))
|
66 |
|
67 |
-
# Conectar automáticamente al índice "
|
68 |
connect_to_pinecone(INDEX_NAME)
|
69 |
|
70 |
# Función para imprimir el nombre del índice actual (puede ser usada en otras celdas)
|
@@ -182,7 +182,15 @@ def chat_function(message, history):
|
|
182 |
filtered_links = []
|
183 |
if relevant_links:
|
184 |
for link in relevant_links:
|
185 |
-
if any(tag in link for tag in ["
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
186 |
tags_detected.append(link) # Save the tag but don't display it
|
187 |
else:
|
188 |
filtered_links.append(link)
|
@@ -193,93 +201,50 @@ def chat_function(message, history):
|
|
193 |
|
194 |
# Now handle the images based on the detected tags
|
195 |
tags_to_images = {
|
196 |
-
"
|
197 |
-
"
|
198 |
-
"
|
199 |
-
"
|
200 |
-
"
|
201 |
-
"
|
202 |
-
"
|
203 |
-
"
|
204 |
-
"
|
205 |
-
"
|
206 |
-
"
|
207 |
-
"
|
208 |
-
"
|
209 |
-
"
|
210 |
-
"
|
211 |
-
"
|
212 |
-
"
|
213 |
-
"
|
214 |
-
"
|
215 |
-
"
|
216 |
-
"
|
217 |
-
"
|
218 |
-
"
|
219 |
-
"
|
220 |
-
"
|
221 |
-
"
|
222 |
-
"
|
223 |
-
"
|
224 |
-
"
|
225 |
-
"
|
226 |
-
"
|
227 |
-
"
|
228 |
-
"
|
229 |
-
"
|
230 |
-
"
|
231 |
-
"
|
232 |
-
"
|
233 |
-
"
|
234 |
-
"
|
235 |
-
"
|
236 |
-
"
|
237 |
-
"
|
238 |
-
"
|
239 |
-
"
|
240 |
-
"celeste_33": "images/celeste_33.jpeg",
|
241 |
-
"celeste_35": "images/celeste_35.jpeg",
|
242 |
-
"celeste_37": "images/celeste_37.jpeg",
|
243 |
-
"celeste_41": "images/celeste_41.jpeg",
|
244 |
-
"celeste_42": "images/celeste_42.jpeg",
|
245 |
-
"celeste_34": "images/celeste_34.jpeg",
|
246 |
-
"celeste_36": "images/celeste_36.jpeg",
|
247 |
-
"sirenita_01": "images/sirenita_01.png",
|
248 |
-
"marino_18": "images/marino_18.jpeg",
|
249 |
-
"marino_17": "images/marino_17.jpeg",
|
250 |
-
"marino_16": "images/marino_16.jpeg",
|
251 |
-
"marino_15": "images/marino_15.jpeg",
|
252 |
-
"rosa_87": "images/rosa_87.jpeg",
|
253 |
-
"rosa_86": "images/rosa_86.png",
|
254 |
-
"rosa_79": "images/rosa_79.jpeg",
|
255 |
-
"rosa_82": "images/rosa_82.png",
|
256 |
-
"rosa_83": "images/rosa_83.jpeg",
|
257 |
-
"rosa_78": "images/rosa_78.jpeg",
|
258 |
-
"rosa_84": "images/rosa_84.jpeg",
|
259 |
-
"rosa_85": "images/rosa_85.jpeg",
|
260 |
-
"rosa_75": "images/rosa_75.jpeg",
|
261 |
-
"rosa_80": "images/rosa_80.png",
|
262 |
-
"rosa_81": "images/rosa_81.png",
|
263 |
-
"rosa_77": "images/rosa_77.jpeg",
|
264 |
-
"rosa_76": "images/rosa_76.png",
|
265 |
-
"blanco_55": "images/blanco_55.jpeg",
|
266 |
-
"blanco_56": "images/blanco_56.jpeg",
|
267 |
-
"blanco_53": "images/blanco_53.jpeg",
|
268 |
-
"blanco_52": "images/blanco_52.jpeg",
|
269 |
-
"blanco_57": "images/blanco_57.jpeg",
|
270 |
-
"blanco_49": "images/blanco_49.jpeg",
|
271 |
-
"blanco_51": "images/blanco_51.jpeg",
|
272 |
-
"blanco_60": "images/blanco_60.jpeg",
|
273 |
-
"blanco_47": "images/blanco_47.jpeg",
|
274 |
-
"blanco_44": "images/blanco_44.jpeg",
|
275 |
-
"blanco_50": "images/blanco_50.jpeg",
|
276 |
-
"blanco_48": "images/blanco_48.jpeg",
|
277 |
-
"blanco_59": "images/blanco_59.jpeg",
|
278 |
-
"blanco_43": "images/blanco_43.jpeg",
|
279 |
-
"blanco_58": "images/blanco_58.png",
|
280 |
-
"blanco_46": "images/blanco_46.jpeg",
|
281 |
-
"blanco_45": "images/blanco_45.jpeg",
|
282 |
-
"blanco_54": "images/blanco_54.jpeg",
|
283 |
}
|
284 |
|
285 |
|
|
|
41 |
print(f"Dimensions: {DIMENSIONS}")
|
42 |
|
43 |
# Establecer el nombre del índice automáticamente
|
44 |
+
INDEX_NAME = 'neonatos'
|
45 |
|
46 |
# Obtener la clave API de Pinecone
|
47 |
#PINECONE_API_KEY = userdata.get('PINECONE_API_KEY')
|
|
|
64 |
except Exception as e:
|
65 |
print(f"Failed to connect to Pinecone index '{index_name}':", str(e))
|
66 |
|
67 |
+
# Conectar automáticamente al índice "neonatos"
|
68 |
connect_to_pinecone(INDEX_NAME)
|
69 |
|
70 |
# Función para imprimir el nombre del índice actual (puede ser usada en otras celdas)
|
|
|
182 |
filtered_links = []
|
183 |
if relevant_links:
|
184 |
for link in relevant_links:
|
185 |
+
if any(tag in link for tag in ["rId101", "rId105", "rId109", "rId113", "rId117",
|
186 |
+
"rId121", "rId125", "rId129", "rId133", "rId136",
|
187 |
+
"rId139", "rId142", "rId145", "rId149", "rId153",
|
188 |
+
"rId157", "rId161", "rId165", "rId169", "rId173",
|
189 |
+
"rId177", "rId180", "rId184", "rId187", "rId192",
|
190 |
+
"rId195", "rId40", "rId44", "rId47", "rId50",
|
191 |
+
"rId53", "rId56", "rId59", "rId63", "rId66",
|
192 |
+
"rId70", "rId73", "rId76", "rId80", "rId83",
|
193 |
+
"rId87", "rId90", "rId94", "rId97"]):
|
194 |
tags_detected.append(link) # Save the tag but don't display it
|
195 |
else:
|
196 |
filtered_links.append(link)
|
|
|
201 |
|
202 |
# Now handle the images based on the detected tags
|
203 |
tags_to_images = {
|
204 |
+
"rId101": "images/rId101.png",
|
205 |
+
"rId105": "images/rId105.png",
|
206 |
+
"rId109": "images/rId109.png",
|
207 |
+
"rId113": "images/rId113.png",
|
208 |
+
"rId117": "images/rId117.png",
|
209 |
+
"rId121": "images/rId121.png",
|
210 |
+
"rId125": "images/rId125.png",
|
211 |
+
"rId129": "images/rId129.png",
|
212 |
+
"rId133": "images/rId133.png",
|
213 |
+
"rId136": "images/rId136.png",
|
214 |
+
"rId139": "images/rId139.png",
|
215 |
+
"rId142": "images/rId142.png",
|
216 |
+
"rId145": "images/rId145.png",
|
217 |
+
"rId149": "images/rId149.png",
|
218 |
+
"rId153": "images/rId153.png",
|
219 |
+
"rId157": "images/rId157.png",
|
220 |
+
"rId161": "images/rId161.png",
|
221 |
+
"rId165": "images/rId165.png",
|
222 |
+
"rId169": "images/rId169.png",
|
223 |
+
"rId173": "images/rId173.png",
|
224 |
+
"rId177": "images/rId177.png",
|
225 |
+
"rId180": "images/rId180.png",
|
226 |
+
"rId184": "images/rId184.png",
|
227 |
+
"rId187": "images/rId187.png",
|
228 |
+
"rId192": "images/rId192.png",
|
229 |
+
"rId195": "images/rId195.png",
|
230 |
+
"rId40": "images/rId40.png",
|
231 |
+
"rId44": "images/rId44.png",
|
232 |
+
"rId47": "images/rId47.png",
|
233 |
+
"rId50": "images/rId50.png",
|
234 |
+
"rId53": "images/rId53.png",
|
235 |
+
"rId56": "images/rId56.png",
|
236 |
+
"rId59": "images/rId59.png",
|
237 |
+
"rId63": "images/rId63.png",
|
238 |
+
"rId66": "images/rId66.png",
|
239 |
+
"rId70": "images/rId70.png",
|
240 |
+
"rId73": "images/rId73.png",
|
241 |
+
"rId76": "images/rId76.png",
|
242 |
+
"rId80": "images/rId80.png",
|
243 |
+
"rId83": "images/rId83.png",
|
244 |
+
"rId87": "images/rId87.png",
|
245 |
+
"rId90": "images/rId90.png",
|
246 |
+
"rId94": "images/rId94.png",
|
247 |
+
"rId97": "images/rId97.png",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
248 |
}
|
249 |
|
250 |
|