Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -21,6 +21,11 @@ from langchain_core.runnables import RunnablePassthrough
|
|
| 21 |
from reportlab.platypus import SimpleDocTemplate, Paragraph
|
| 22 |
from reportlab.lib.styles import getSampleStyleSheet
|
| 23 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
# --------------------------------------------------
|
| 25 |
# PAGE CONFIG
|
| 26 |
# --------------------------------------------------
|
|
@@ -85,12 +90,15 @@ with col2:
|
|
| 85 |
# LOAD VECTOR STORE
|
| 86 |
# --------------------------------------------------
|
| 87 |
@st.cache_resource
|
|
|
|
|
|
|
|
|
|
| 88 |
def load_vectorstore():
|
| 89 |
embeddings = HuggingFaceEmbeddings(
|
| 90 |
model_name="sentence-transformers/all-MiniLM-L6-v2"
|
| 91 |
)
|
| 92 |
return FAISS.load_local(
|
| 93 |
-
|
| 94 |
embeddings,
|
| 95 |
allow_dangerous_deserialization=True
|
| 96 |
)
|
|
|
|
| 21 |
from reportlab.platypus import SimpleDocTemplate, Paragraph
|
| 22 |
from reportlab.lib.styles import getSampleStyleSheet
|
| 23 |
|
| 24 |
+
# ================================
|
| 25 |
+
# Constants / Config
|
| 26 |
+
# ================================
|
| 27 |
+
VECTORSTORE_PATH = "vectorstore"
|
| 28 |
+
|
| 29 |
# --------------------------------------------------
|
| 30 |
# PAGE CONFIG
|
| 31 |
# --------------------------------------------------
|
|
|
|
| 90 |
# LOAD VECTOR STORE
|
| 91 |
# --------------------------------------------------
|
| 92 |
@st.cache_resource
|
| 93 |
+
from langchain_community.embeddings import HuggingFaceEmbeddings
|
| 94 |
+
from langchain_community.vectorstores import FAISS
|
| 95 |
+
|
| 96 |
def load_vectorstore():
|
| 97 |
embeddings = HuggingFaceEmbeddings(
|
| 98 |
model_name="sentence-transformers/all-MiniLM-L6-v2"
|
| 99 |
)
|
| 100 |
return FAISS.load_local(
|
| 101 |
+
VECTORSTORE_PATH,
|
| 102 |
embeddings,
|
| 103 |
allow_dangerous_deserialization=True
|
| 104 |
)
|