Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,7 +2,6 @@ import os
|
|
| 2 |
import json
|
| 3 |
import gradio as gr
|
| 4 |
|
| 5 |
-
from langchain_community.vectorstores import Chroma
|
| 6 |
from huggingface_hub import HfApi, login
|
| 7 |
from PyPDF2 import PdfReader
|
| 8 |
from langchain_huggingface import HuggingFaceEmbeddings
|
|
@@ -145,19 +144,6 @@ def rag_workflow(query):
|
|
| 145 |
return response
|
| 146 |
|
| 147 |
|
| 148 |
-
|
| 149 |
-
def get_chroma_vectorstore2(embedding_model):
|
| 150 |
-
# Define the persist_directory path
|
| 151 |
-
vectorstore_path = "/home/user/data"
|
| 152 |
-
|
| 153 |
-
# Ensure the directory exists
|
| 154 |
-
os.makedirs(vectorstore_path, exist_ok=True) # Creates it if it doesn't exist
|
| 155 |
-
print(f"Using persist_directory: {vectorstore_path}")
|
| 156 |
-
|
| 157 |
-
# Initialize the Chroma vectorstore with the specified persist_directory
|
| 158 |
-
vectorstore = Chroma(persist_directory=vectorstore_path, embedding_function=embedding_model)
|
| 159 |
-
return vectorstore
|
| 160 |
-
|
| 161 |
def initialize():
|
| 162 |
global vector_store, chunks, llm
|
| 163 |
|
|
|
|
| 2 |
import json
|
| 3 |
import gradio as gr
|
| 4 |
|
|
|
|
| 5 |
from huggingface_hub import HfApi, login
|
| 6 |
from PyPDF2 import PdfReader
|
| 7 |
from langchain_huggingface import HuggingFaceEmbeddings
|
|
|
|
| 144 |
return response
|
| 145 |
|
| 146 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 147 |
def initialize():
|
| 148 |
global vector_store, chunks, llm
|
| 149 |
|