Spaces:
Sleeping
Sleeping
Refactor unit mapping in prediction process by replacing UnitMapper with UnitSimilarityMapper for improved similarity calculations and error handling.
Browse files- data/cached_similar_items_bygroup_abstractsimilaritymapper.pkl +3 -0
- data/cached_similar_items_bygroup_namesimilaritymapper.pkl +3 -0
- data/cached_similar_items_bygroup_subsubjectsimilaritymapper.pkl +3 -0
- data/cached_similar_items_subjectsimilaritymapper.pkl +3 -0
- data/cached_similar_items_unitsimilaritymapper.pkl +3 -0
- data/outputData.csv +0 -0
- routes/predict.py +4 -4
data/cached_similar_items_bygroup_abstractsimilaritymapper.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:a8547d21d9847e0191da9528f627c36fdbbf46fae340de39757fd37fa978a1fa
|
3 |
+
size 98091
|
data/cached_similar_items_bygroup_namesimilaritymapper.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e5aeb712d1a1ae09dd07d53e5415eb4dd17647c4927972897455db956f44adba
|
3 |
+
size 400757
|
data/cached_similar_items_bygroup_subsubjectsimilaritymapper.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:a090da26e03a6aca5526c6f4c41050c8b5a6c83a01943cece7384d9ddb6d048e
|
3 |
+
size 13311
|
data/cached_similar_items_subjectsimilaritymapper.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:231bd962fe784389cefac613f0597e26510501506e434355668dce03da620560
|
3 |
+
size 4116
|
data/cached_similar_items_unitsimilaritymapper.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:27482a66588006f51733369ca6dd41065669318b5f845439d80437695644a142
|
3 |
+
size 2301
|
data/outputData.csv
CHANGED
The diff for this file is too large to render.
See raw diff
|
|
routes/predict.py
CHANGED
@@ -20,7 +20,7 @@ from mapping_lib.name_similarity_mapper import NameSimilarityMapper
|
|
20 |
from mapping_lib.sub_subject_and_name_data_mapper import SubSubjectAndNameDataMapper
|
21 |
from mapping_lib.abstract_similarity_mapper import AbstractSimilarityMapper
|
22 |
from mapping_lib.name_and_abstract_mapper import NameAndAbstractDataMapper
|
23 |
-
from mapping_lib.
|
24 |
from mapping_lib.standard_name_mapper import StandardNameMapper
|
25 |
|
26 |
from config import UPLOAD_DIR, OUTPUT_DIR
|
@@ -227,7 +227,7 @@ async def predict(
|
|
227 |
try:
|
228 |
# Unit mapping
|
229 |
if sentence_service.df_unit_map_data is not None:
|
230 |
-
unit_mapper =
|
231 |
cached_embedding_helper=sentence_service.unit_cached_embedding_helper,
|
232 |
df_map_data=sentence_service.df_unit_map_data,
|
233 |
)
|
@@ -505,14 +505,14 @@ async def predict_raw(
|
|
505 |
try:
|
506 |
# Unit mapping
|
507 |
if sentence_service.df_unit_map_data is not None:
|
508 |
-
unit_mapper =
|
509 |
cached_embedding_helper=sentence_service.unit_cached_embedding_helper,
|
510 |
df_map_data=sentence_service.df_unit_map_data,
|
511 |
)
|
512 |
unit_mapper.predict_input(df_input_data=df_input_data)
|
513 |
|
514 |
except Exception as e:
|
515 |
-
print(f"Error processing
|
516 |
raise HTTPException(status_code=500, detail=str(e))
|
517 |
|
518 |
# Ensure required columns exist
|
|
|
20 |
from mapping_lib.sub_subject_and_name_data_mapper import SubSubjectAndNameDataMapper
|
21 |
from mapping_lib.abstract_similarity_mapper import AbstractSimilarityMapper
|
22 |
from mapping_lib.name_and_abstract_mapper import NameAndAbstractDataMapper
|
23 |
+
from mapping_lib.unit_similarity_mapper import UnitSimilarityMapper
|
24 |
from mapping_lib.standard_name_mapper import StandardNameMapper
|
25 |
|
26 |
from config import UPLOAD_DIR, OUTPUT_DIR
|
|
|
227 |
try:
|
228 |
# Unit mapping
|
229 |
if sentence_service.df_unit_map_data is not None:
|
230 |
+
unit_mapper = UnitSimilarityMapper(
|
231 |
cached_embedding_helper=sentence_service.unit_cached_embedding_helper,
|
232 |
df_map_data=sentence_service.df_unit_map_data,
|
233 |
)
|
|
|
505 |
try:
|
506 |
# Unit mapping
|
507 |
if sentence_service.df_unit_map_data is not None:
|
508 |
+
unit_mapper = UnitSimilarityMapper(
|
509 |
cached_embedding_helper=sentence_service.unit_cached_embedding_helper,
|
510 |
df_map_data=sentence_service.df_unit_map_data,
|
511 |
)
|
512 |
unit_mapper.predict_input(df_input_data=df_input_data)
|
513 |
|
514 |
except Exception as e:
|
515 |
+
print(f"Error processing UnitSimilarityMapper: {e}")
|
516 |
raise HTTPException(status_code=500, detail=str(e))
|
517 |
|
518 |
# Ensure required columns exist
|