AashitaK commited on
Commit
461d4fe
·
verified ·
1 Parent(s): c8db20e

Update utils/file_utils.py

Browse files
Files changed (1) hide show
  1. utils/file_utils.py +8 -6
utils/file_utils.py CHANGED
@@ -156,16 +156,18 @@ def load_embeddings(database, database_filepath, embeddings_filepath):
156
  previous_timestamp = load_timestamp(timestamp_filepath)
157
 
158
  # Check if the timestamp of the database file is different from the stored timestamp (DB_UPDATE_TIMESTAMP)
159
- if database_timestamp != previous_timestamp:
160
- print("embeddings updated")
 
 
 
 
161
  # If the database file has been updated, generate new embeddings and save them to the embeddings file
162
  database_embeddings = update_embeddings(database, embeddings_filepath)
163
 
164
  # Update the stored timestamp
165
  save_timestamp(database_timestamp, timestamp_filepath)
166
- else:
167
- print("embeddings not updated")
168
- # If the database file has not been updated, load the existing embeddings from the pickle file
169
- database_embeddings = load_pickle(embeddings_filepath)
170
 
171
  return database_embeddings
 
156
  previous_timestamp = load_timestamp(timestamp_filepath)
157
 
158
  # Check if the timestamp of the database file is different from the stored timestamp (DB_UPDATE_TIMESTAMP)
159
+ if database_timestamp == previous_timestamp:
160
+ print("Embeddings loaded.")
161
+ # If the database file has not been updated, load the existing embeddings from the pickle file
162
+ database_embeddings = load_pickle(embeddings_filepath)
163
+ else:
164
+ print("Embeddings updating.....")
165
  # If the database file has been updated, generate new embeddings and save them to the embeddings file
166
  database_embeddings = update_embeddings(database, embeddings_filepath)
167
 
168
  # Update the stored timestamp
169
  save_timestamp(database_timestamp, timestamp_filepath)
170
+ print("Embeddings updated.")
171
+
 
 
172
 
173
  return database_embeddings