Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Jan Mühlnikel
commited on
Commit
·
9821670
1
Parent(s):
dbd3423
enhanced documentation
Browse files
app_matching_page.py
CHANGED
|
@@ -12,21 +12,15 @@ import pickle
|
|
| 12 |
from sentence_transformers import SentenceTransformer
|
| 13 |
from modules.multimatch_result_table import show_multi_table
|
| 14 |
from modules.singlematch_result_table import show_single_table
|
| 15 |
-
from functions.
|
| 16 |
from functions.filter_single_project_matching import filter_single
|
| 17 |
from functions.multi_project_matching import calc_multi_matches
|
| 18 |
from functions.same_country_filter import same_country_filter
|
| 19 |
from functions.single_project_matching import find_similar
|
| 20 |
import gc
|
| 21 |
|
| 22 |
-
"""
|
| 23 |
-
def get_process_memory():
|
| 24 |
-
process = psutil.Process(os.getpid())
|
| 25 |
-
return process.memory_info().rss / (1024 * 1024)
|
| 26 |
-
"""
|
| 27 |
|
| 28 |
# Catch DATA
|
| 29 |
-
|
| 30 |
# Load Similarity matrix
|
| 31 |
@st.cache_data
|
| 32 |
def load_sim_matrix():
|
|
|
|
| 12 |
from sentence_transformers import SentenceTransformer
|
| 13 |
from modules.multimatch_result_table import show_multi_table
|
| 14 |
from modules.singlematch_result_table import show_single_table
|
| 15 |
+
from functions.filter_multi_project_matching import filter_multi
|
| 16 |
from functions.filter_single_project_matching import filter_single
|
| 17 |
from functions.multi_project_matching import calc_multi_matches
|
| 18 |
from functions.same_country_filter import same_country_filter
|
| 19 |
from functions.single_project_matching import find_similar
|
| 20 |
import gc
|
| 21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
# Catch DATA
|
|
|
|
| 24 |
# Load Similarity matrix
|
| 25 |
@st.cache_data
|
| 26 |
def load_sim_matrix():
|
functions/filter_multi_project_matching.py
CHANGED
|
@@ -1,12 +1,16 @@
|
|
| 1 |
import pandas as pd
|
| 2 |
from functions.semantic_search import search
|
| 3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
def contains_code(crs_codes, code_list):
|
| 5 |
codes = str(crs_codes).split(';')
|
| 6 |
return any(code in code_list for code in codes)
|
| 7 |
|
| 8 |
def filter_multi(df, crs3_list, crs5_list, sdg_str, country_code_list, orga_code_list, query, model, embeddings, TOP_X_PROJECTS=30):
|
| 9 |
-
# Check if filters where not all
|
| 10 |
if crs3_list != [] or crs5_list != [] or sdg_str != "" or query != "":
|
| 11 |
|
| 12 |
# FILTER CRS
|
|
|
|
| 1 |
import pandas as pd
|
| 2 |
from functions.semantic_search import search
|
| 3 |
|
| 4 |
+
"""
|
| 5 |
+
Filter for the multi project matching
|
| 6 |
+
"""
|
| 7 |
+
|
| 8 |
def contains_code(crs_codes, code_list):
|
| 9 |
codes = str(crs_codes).split(';')
|
| 10 |
return any(code in code_list for code in codes)
|
| 11 |
|
| 12 |
def filter_multi(df, crs3_list, crs5_list, sdg_str, country_code_list, orga_code_list, query, model, embeddings, TOP_X_PROJECTS=30):
|
| 13 |
+
# Check if filters where not all can be selected are empty
|
| 14 |
if crs3_list != [] or crs5_list != [] or sdg_str != "" or query != "":
|
| 15 |
|
| 16 |
# FILTER CRS
|