Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -237,9 +237,19 @@ def split_into_chunks(texts, references, chunk_size, chunk_overlap):
|
|
| 237 |
chunks = []
|
| 238 |
|
| 239 |
for text, reference in zip(texts, references):
|
| 240 |
-
chunks.extend([
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 241 |
return chunks
|
| 242 |
|
|
|
|
| 243 |
# Setup Vectorstore
|
| 244 |
def embed_documents_into_vectorstore(chunks, model_name, persist_directory):
|
| 245 |
print("Start setup_vectorstore_function")
|
|
|
|
| 237 |
chunks = []
|
| 238 |
|
| 239 |
for text, reference in zip(texts, references):
|
| 240 |
+
chunks.extend([
|
| 241 |
+
Document(
|
| 242 |
+
page_content=chunk,
|
| 243 |
+
metadata={
|
| 244 |
+
"source": reference,
|
| 245 |
+
"usage": "doc"
|
| 246 |
+
}
|
| 247 |
+
)
|
| 248 |
+
for chunk in text_splitter.split_text(text)
|
| 249 |
+
])
|
| 250 |
return chunks
|
| 251 |
|
| 252 |
+
|
| 253 |
# Setup Vectorstore
|
| 254 |
def embed_documents_into_vectorstore(chunks, model_name, persist_directory):
|
| 255 |
print("Start setup_vectorstore_function")
|