Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Jan Mühlnikel
commited on
Commit
•
a272945
1
Parent(s):
24c47d8
test ram
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
|
|
functions/__pycache__/filter_projects.cpython-310.pyc
CHANGED
Binary files a/functions/__pycache__/filter_projects.cpython-310.pyc and b/functions/__pycache__/filter_projects.cpython-310.pyc differ
|
|
functions/filter_projects.py
CHANGED
@@ -43,6 +43,7 @@ def filter_projects(df, crs3_list, crs5_list, sdg_str, country_code_list, orga_c
|
|
43 |
|
44 |
|
45 |
return df
|
|
|
46 |
|
47 |
|
48 |
|
|
|
43 |
|
44 |
|
45 |
return df
|
46 |
+
|
47 |
|
48 |
|
49 |
|
similarity_page.py
CHANGED
@@ -117,7 +117,8 @@ def load_embeddings_and_index():
|
|
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()
|
@@ -216,16 +217,19 @@ def show_page():
|
|
216 |
#with col2:
|
217 |
# Semantic Search
|
218 |
#searched_filtered_df = semantic_search.show_search(model, embeddings, sentences, filtered_df, TOP_X_PROJECTS)
|
|
|
|
|
|
|
|
|
219 |
|
220 |
-
|
221 |
-
|
222 |
-
p1_df, p2_df = calc_matches(filtered_df, projects_df, nonsameorgas_sim_matrix, TOP_X_PROJECTS)
|
223 |
|
|
|
|
|
|
|
224 |
else:
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
show_table(p1_df, p2_df)
|
229 |
-
|
230 |
-
del p1_df, p2_df, crs3_list, crs5_list, sdg_str, filtered_df
|
231 |
gc.collect()
|
|
|
117 |
|
118 |
# USE CACHE FUNCTIONS
|
119 |
sim_matrix = load_sim_matrix()
|
120 |
+
#nonsameorgas_sim_matrix = load_nonsameorga_sim_matrix()
|
121 |
+
nonsameorgas_sim_matrix = sim_matrix
|
122 |
projects_df = load_projects()
|
123 |
|
124 |
CRS3_MERGED = getCRS3()
|
|
|
217 |
#with col2:
|
218 |
# Semantic Search
|
219 |
#searched_filtered_df = semantic_search.show_search(model, embeddings, sentences, filtered_df, TOP_X_PROJECTS)
|
220 |
+
if isinstance(filtered_df, pd.DataFrame):
|
221 |
+
# FIND MATCHES
|
222 |
+
if different_orga_checkbox:
|
223 |
+
p1_df, p2_df = calc_matches(filtered_df, projects_df, nonsameorgas_sim_matrix, TOP_X_PROJECTS)
|
224 |
|
225 |
+
else:
|
226 |
+
p1_df, p2_df = calc_matches(filtered_df, projects_df, sim_matrix, TOP_X_PROJECTS)
|
|
|
227 |
|
228 |
+
# SHOW THE RESULT
|
229 |
+
show_table(p1_df, p2_df)
|
230 |
+
del p1_df, p2_df
|
231 |
else:
|
232 |
+
st.write("Select at least on CRS 3, SDG or type in a query")
|
233 |
+
|
234 |
+
del crs3_list, crs5_list, sdg_str, filtered_df
|
|
|
|
|
|
|
235 |
gc.collect()
|