Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -478,21 +478,10 @@ def process_answer(question, full_text):
|
|
| 478 |
embeddings = SentenceTransformerEmbeddings(model_name="all-MiniLM-L6-v2")
|
| 479 |
|
| 480 |
|
| 481 |
-
import tempfile
|
| 482 |
-
import os
|
| 483 |
-
import shutil
|
| 484 |
from langchain_community.vectorstores import Chroma
|
| 485 |
|
| 486 |
-
#
|
| 487 |
-
|
| 488 |
-
|
| 489 |
-
# Clean up old vectorstore
|
| 490 |
-
if os.path.exists(chroma_dir):
|
| 491 |
-
shutil.rmtree(chroma_dir)
|
| 492 |
-
os.makedirs(chroma_dir, exist_ok=True)
|
| 493 |
-
|
| 494 |
-
# Create Chroma vector store
|
| 495 |
-
db = Chroma.from_documents(splits, embeddings, persist_directory=chroma_dir)
|
| 496 |
retriever = db.as_retriever()
|
| 497 |
|
| 498 |
|
|
|
|
| 478 |
embeddings = SentenceTransformerEmbeddings(model_name="all-MiniLM-L6-v2")
|
| 479 |
|
| 480 |
|
|
|
|
|
|
|
|
|
|
| 481 |
from langchain_community.vectorstores import Chroma
|
| 482 |
|
| 483 |
+
# Create Chroma in-memory vector store
|
| 484 |
+
db = Chroma.from_documents(splits, embeddings)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 485 |
retriever = db.as_retriever()
|
| 486 |
|
| 487 |
|