Jan Mühlnikel commited on
Commit
7b52ef0
1 Parent(s): 530c653

ram optimizations

Browse files
__pycache__/similarity_page.cpython-310.pyc CHANGED
Binary files a/__pycache__/similarity_page.cpython-310.pyc and b/__pycache__/similarity_page.cpython-310.pyc differ
 
similarity_page.py CHANGED
@@ -29,9 +29,15 @@ def load_sim_matrix():
29
  loaded_matrix = load_npz("src/extended_similarities.npz")
30
  dense_matrix = loaded_matrix.toarray()
31
 
32
- loaded_nonsimorga_matrix = load_npz("src/extended_similarities_nonsimorga.npz")
33
- dense_nonsimorga_matrix = loaded_nonsimorga_matrix.toarray()
34
- return dense_matrix, dense_nonsimorga_matrix
 
 
 
 
 
 
35
 
36
  # Load Projects DFs
37
  @st.cache_data
@@ -105,13 +111,13 @@ def load_embeddings_and_index():
105
  # Load embeddings
106
  with open("src/embeddings.pkl", "rb") as fIn:
107
  stored_data = pickle.load(fIn)
108
- sentences = stored_data["sentences"]
109
  embeddings = stored_data["embeddings"]
110
 
111
- return sentences, embeddings
112
 
113
  # USE CACHE FUNCTIONS
114
- sim_matrix, nonsameorgas_sim_matrix = load_sim_matrix()
 
115
  projects_df = load_projects()
116
 
117
  CRS3_MERGED = getCRS3()
@@ -122,7 +128,7 @@ COUNTRY_OPTION_LIST = getCountry()
122
 
123
  # LOAD MODEL FROM CACHE FO SEMANTIC SEARCH
124
  model = load_model()
125
- sentences, embeddings = load_embeddings_and_index()
126
 
127
  def show_page():
128
  st.write(f"Current RAM usage of this app: {get_process_memory():.2f} MB")
 
29
  loaded_matrix = load_npz("src/extended_similarities.npz")
30
  dense_matrix = loaded_matrix.toarray()
31
 
32
+ return dense_matrix
33
+
34
+ # Load Non Similar Orga Matrix
35
+ @st.cache_data
36
+ def load_nonsameorga_sim_matrix():
37
+ loaded_matrix = load_npz("src/extended_similarities_nonsimorga.npz")
38
+ dense_matrix = loaded_matrix.toarray()
39
+
40
+ return dense_matrix
41
 
42
  # Load Projects DFs
43
  @st.cache_data
 
111
  # Load embeddings
112
  with open("src/embeddings.pkl", "rb") as fIn:
113
  stored_data = pickle.load(fIn)
 
114
  embeddings = stored_data["embeddings"]
115
 
116
+ return embeddings
117
 
118
  # USE CACHE FUNCTIONS
119
+ sim_matrix = load_sim_matrix()
120
+ nonsameorgas_sim_matrix = load_nonsameorga_sim_matrix()
121
  projects_df = load_projects()
122
 
123
  CRS3_MERGED = getCRS3()
 
128
 
129
  # LOAD MODEL FROM CACHE FO SEMANTIC SEARCH
130
  model = load_model()
131
+ embeddings = load_embeddings_and_index()
132
 
133
  def show_page():
134
  st.write(f"Current RAM usage of this app: {get_process_memory():.2f} MB")