Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -88,10 +88,10 @@ def process_pdf(file):
|
|
88 |
chunks = text_splitter.split_text(text)
|
89 |
|
90 |
# Create embeddings for each chunk
|
91 |
-
embeddings = embedding_function(chunks)
|
92 |
-
|
93 |
# Store each chunk in ChromaDB
|
94 |
-
for i, chunk in enumerate(
|
95 |
collection.add(
|
96 |
documents=[chunk],
|
97 |
metadatas=[{"filename": file.name, "chunk_id": i}],
|
@@ -106,7 +106,7 @@ def search_similar_documents(prompt):
|
|
106 |
# Führe die Ähnlichkeitssuche durch
|
107 |
results = collection.query(
|
108 |
query_embeddings=[query_embedding],
|
109 |
-
n_results=
|
110 |
)
|
111 |
|
112 |
# Formatiere die Ergebnisse
|
|
|
88 |
chunks = text_splitter.split_text(text)
|
89 |
|
90 |
# Create embeddings for each chunk
|
91 |
+
#embeddings = embedding_function(chunks)
|
92 |
+
embeddings = embedding_function(text)
|
93 |
# Store each chunk in ChromaDB
|
94 |
+
for i, chunk in enumerate(text):
|
95 |
collection.add(
|
96 |
documents=[chunk],
|
97 |
metadatas=[{"filename": file.name, "chunk_id": i}],
|
|
|
106 |
# Führe die Ähnlichkeitssuche durch
|
107 |
results = collection.query(
|
108 |
query_embeddings=[query_embedding],
|
109 |
+
n_results=20
|
110 |
)
|
111 |
|
112 |
# Formatiere die Ergebnisse
|