KushwanthK commited on
Commit
575b473
·
verified ·
1 Parent(s): 22b2b1e

update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -12
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
- import pickle
141
-
142
- # File path to the pickle file
143
- file_path = "./HuggingFaceEmbeddings.pkl"
144
-
145
- # Load embeddings from the pickle file
146
- with open(file_path, "rb") as f:
147
- faiss_index = pickle.load(f)
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 = """