Spaces:
Running
Running
ryanrwatkins
commited on
Commit
•
13dfb45
1
Parent(s):
dce2ac0
Update app.py
Browse files
app.py
CHANGED
@@ -61,13 +61,14 @@ google_api_key = os.environ['gemini_key']
|
|
61 |
HF_key = os.environ['HF_token']
|
62 |
cohere_api_key = os.environ['cohere_api']
|
63 |
|
|
|
64 |
|
65 |
def langchain_document_loader():
|
66 |
"""
|
67 |
Load documents from the temporary directory (TMP_DIR).
|
68 |
Files can be in txt, pdf, CSV or docx format.
|
69 |
"""
|
70 |
-
current_dir = os.getcwd()
|
71 |
#TMP_DIR = current_dir
|
72 |
global documents
|
73 |
documents = []
|
@@ -162,7 +163,7 @@ embeddings_HuggingFace = select_embeddings_model(LLM_service="HuggingFace")
|
|
162 |
|
163 |
def create_vectorstore(embeddings,documents,vectorstore_name):
|
164 |
"""Create a Chroma vector database."""
|
165 |
-
persist_directory = (
|
166 |
vector_store = Chroma.from_documents(
|
167 |
documents=documents,
|
168 |
embedding=embeddings,
|
@@ -212,7 +213,7 @@ print("vector_store_google:",vector_store_google._collection.count(),"chunks.")
|
|
212 |
"""
|
213 |
|
214 |
vector_store_HF = Chroma(
|
215 |
-
persist_directory =
|
216 |
embedding_function=embeddings_HuggingFace)
|
217 |
print("vector_store_HF:",vector_store_HF._collection.count(),"chunks.")
|
218 |
|
|
|
61 |
HF_key = os.environ['HF_token']
|
62 |
cohere_api_key = os.environ['cohere_api']
|
63 |
|
64 |
+
current_dir = os.getcwd()
|
65 |
|
66 |
def langchain_document_loader():
|
67 |
"""
|
68 |
Load documents from the temporary directory (TMP_DIR).
|
69 |
Files can be in txt, pdf, CSV or docx format.
|
70 |
"""
|
71 |
+
#current_dir = os.getcwd()
|
72 |
#TMP_DIR = current_dir
|
73 |
global documents
|
74 |
documents = []
|
|
|
163 |
|
164 |
def create_vectorstore(embeddings,documents,vectorstore_name):
|
165 |
"""Create a Chroma vector database."""
|
166 |
+
persist_directory = (current_dir + "/" + vectorstore_name)
|
167 |
vector_store = Chroma.from_documents(
|
168 |
documents=documents,
|
169 |
embedding=embeddings,
|
|
|
213 |
"""
|
214 |
|
215 |
vector_store_HF = Chroma(
|
216 |
+
persist_directory = current_dir + "/Vit_All_HF_Embeddings",
|
217 |
embedding_function=embeddings_HuggingFace)
|
218 |
print("vector_store_HF:",vector_store_HF._collection.count(),"chunks.")
|
219 |
|