Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -60,15 +60,7 @@ def qa(question):
|
|
60 |
k = 5 # Nombre de voisins à récupérer
|
61 |
D, I = index.search(question_embeddings, k=k) # distances et indices
|
62 |
|
63 |
-
|
64 |
-
if I.size > 0:
|
65 |
-
for indices in I.tolist():
|
66 |
-
for index in indices:
|
67 |
-
# Vérifiez si l'index est valide avant d'accéder à la liste chunks
|
68 |
-
if 0 <= index < len(chunks):
|
69 |
-
retrieved_chunks.append(chunks[index])
|
70 |
-
else:
|
71 |
-
print(f"Avertissement : Index FAISS hors de portée de la liste chunks: {index}")
|
72 |
|
73 |
if not retrieved_chunks:
|
74 |
context = "Aucune information pertinente trouvée."
|
|
|
60 |
k = 5 # Nombre de voisins à récupérer
|
61 |
D, I = index.search(question_embeddings, k=k) # distances et indices
|
62 |
|
63 |
+
retrieved_chunk = [chunks[i] for i in I.tolist()[0]] if I.size > 0 else "Aucune information pertinente trouvée."
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
|
65 |
if not retrieved_chunks:
|
66 |
context = "Aucune information pertinente trouvée."
|