File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -666,9 +666,27 @@ def generate_inference_job(self, classification_type):
666
666
667
667
InferenceJob = apps .get_model ("inference" , "InferenceJob" )
668
668
ModelVersion = apps .get_model ("inference" , "ModelVersion" )
669
+
670
+ try :
671
+ model_version = ModelVersion .get_active_version (classification_type )
672
+ except ModelVersion .DoesNotExist :
673
+ if classification_type == 1 : # TDAMM
674
+ model_name = "TDAMM"
675
+ elif classification_type == 2 : # DIVISION
676
+ model_name = "DC"
677
+ else :
678
+ raise ValueError (f"Unsupported classification type: { classification_type } " )
679
+
680
+ model_version = ModelVersion .objects .create (
681
+ api_identifier = model_name ,
682
+ description = f"{ model_name .upper ()} classification model" ,
683
+ classification_type = classification_type ,
684
+ is_active = True ,
685
+ )
686
+
669
687
return InferenceJob .objects .create (
670
688
collection = self ,
671
- model_version = ModelVersion . get_active_version ( classification_type ) ,
689
+ model_version = model_version ,
672
690
)
673
691
674
692
def queue_necessary_classifications (self ):
You can’t perform that action at this time.
0 commit comments