Spaces:
Sleeping
Sleeping
KushwanthK
commited on
update app.py
Browse files
app.py
CHANGED
@@ -135,19 +135,16 @@ def display_highlighted_pdf(file_path, text_to_highlight, sources):
|
|
135 |
import os
|
136 |
# import pinecone
|
137 |
|
138 |
-
|
139 |
def get_faiss_semantic_index():
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
print("Embeddings loaded successfully.")
|
150 |
-
return faiss_index
|
151 |
|
152 |
# def promt_engineer(text):
|
153 |
PROMPT_TEMPLATE = """
|
|
|
135 |
import os
|
136 |
# import pinecone
|
137 |
|
138 |
+
import pickle
|
139 |
def get_faiss_semantic_index():
|
140 |
+
try:
|
141 |
+
# Load embeddings from the pickle file
|
142 |
+
with open(file_path, "rb") as f:
|
143 |
+
faiss_index = pickle.load(f)
|
144 |
+
st.write("Embeddings loaded successfully.")
|
145 |
+
return faiss_index
|
146 |
+
except Exception as e:
|
147 |
+
st.error(f"Error loading embeddings: {e}")
|
|
|
|
|
|
|
148 |
|
149 |
# def promt_engineer(text):
|
150 |
PROMPT_TEMPLATE = """
|