Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -387,6 +387,18 @@ def rag_workflow(query):
|
|
| 387 |
return response.content
|
| 388 |
|
| 389 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 390 |
def initialize():
|
| 391 |
global vector_store, chunks, llm
|
| 392 |
|
|
@@ -431,18 +443,6 @@ def initialize():
|
|
| 431 |
initialize()
|
| 432 |
|
| 433 |
|
| 434 |
-
def get_chroma_vectorstore2(embedding_model):
|
| 435 |
-
# Define the persist_directory path
|
| 436 |
-
vectorstore_path = "/home/user/data"
|
| 437 |
-
|
| 438 |
-
# Ensure the directory exists
|
| 439 |
-
os.makedirs(vectorstore_path, exist_ok=True) # Creates it if it doesn't exist
|
| 440 |
-
print(f"Using persist_directory: {vectorstore_path}")
|
| 441 |
-
|
| 442 |
-
# Initialize the Chroma vectorstore with the specified persist_directory
|
| 443 |
-
vectorstore = Chroma(persist_directory=vectorstore_path, embedding_function=embedding_model)
|
| 444 |
-
return vectorstore
|
| 445 |
-
|
| 446 |
# Example usage
|
| 447 |
# embedding_model should be your embedding function or model instance
|
| 448 |
# vectorstore = get_chroma_vectorstore(embedding_model)
|
|
|
|
| 387 |
return response.content
|
| 388 |
|
| 389 |
|
| 390 |
+
def get_chroma_vectorstore2(embedding_model):
|
| 391 |
+
# Define the persist_directory path
|
| 392 |
+
vectorstore_path = "/home/user/data"
|
| 393 |
+
|
| 394 |
+
# Ensure the directory exists
|
| 395 |
+
os.makedirs(vectorstore_path, exist_ok=True) # Creates it if it doesn't exist
|
| 396 |
+
print(f"Using persist_directory: {vectorstore_path}")
|
| 397 |
+
|
| 398 |
+
# Initialize the Chroma vectorstore with the specified persist_directory
|
| 399 |
+
vectorstore = Chroma(persist_directory=vectorstore_path, embedding_function=embedding_model)
|
| 400 |
+
return vectorstore
|
| 401 |
+
|
| 402 |
def initialize():
|
| 403 |
global vector_store, chunks, llm
|
| 404 |
|
|
|
|
| 443 |
initialize()
|
| 444 |
|
| 445 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 446 |
# Example usage
|
| 447 |
# embedding_model should be your embedding function or model instance
|
| 448 |
# vectorstore = get_chroma_vectorstore(embedding_model)
|