Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -81,10 +81,14 @@ def get_vectorstore_from_url(url):
|
|
81 |
model_name=model, encode_kwargs=encode_kwargs, model_kwargs={"device": "cpu"}
|
82 |
)
|
83 |
# load from disk
|
84 |
-
vector_store = Chroma(persist_directory="/home/user/.cache/chroma_db", embedding_function=embeddings)
|
85 |
|
86 |
#vectorstore = FAISS.from_texts(texts=text_chunks, embedding=embeddings)
|
87 |
vector_store = Chroma.from_documents(document_chunks, embeddings, persist_directory="/home/user/.cache/chroma_db")
|
|
|
|
|
|
|
|
|
88 |
|
89 |
return vector_store
|
90 |
|
|
|
81 |
model_name=model, encode_kwargs=encode_kwargs, model_kwargs={"device": "cpu"}
|
82 |
)
|
83 |
# load from disk
|
84 |
+
#vector_store = Chroma(persist_directory="/home/user/.cache/chroma_db", embedding_function=embeddings)
|
85 |
|
86 |
#vectorstore = FAISS.from_texts(texts=text_chunks, embedding=embeddings)
|
87 |
vector_store = Chroma.from_documents(document_chunks, embeddings, persist_directory="/home/user/.cache/chroma_db")
|
88 |
+
|
89 |
+
all_documents = vector_store.get()['documents']
|
90 |
+
total_records = len(all_documents)
|
91 |
+
print("Total records in the collection: ", total_records)
|
92 |
|
93 |
return vector_store
|
94 |
|