Skip to content

Commit 9ea7a46

Browse files
committed
Correctly set CDB path within v2 model packs
1 parent 05ad081 commit 9ea7a46

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

medcat-trainer/webapp/api/api/models.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,12 @@ def save(self, *args, **kwargs):
6464
CAT.load_cdb(unpacked_model_pack_path)
6565
concept_db = ConceptDB()
6666
unpacked_file_name = self.model_pack.file.name.replace('.zip', '')
67-
concept_db.cdb_file.name = os.path.join(unpacked_file_name, 'cdb.dat')
67+
# cdb path for v2
68+
cdb_path = os.path.join(unpacked_file_name, 'cdb')
69+
if not os.path.exists(cdb_path):
70+
# cdb path for v1
71+
cdb_path = os.path.join(unpacked_file_name, 'cdb.dat')
72+
concept_db.cdb_file.name = cdb_path
6873
concept_db.name = f'{self.name}_CDB'
6974
concept_db.save(skip_load=True)
7075
self.concept_db = concept_db

0 commit comments

Comments
 (0)