File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -219,10 +219,10 @@ def _set_params(
219219 if custom_classifier .endswith (".tflite" ):
220220 cfg .LABELS_FILE = custom_classifier .replace (".tflite" , "_Labels.txt" ) # same for labels file
221221
222- if not os .path .isfile (cfg .LABELS_FILE ):
222+ if not os .path .isfile (cfg .LABELS_FILE ): # if the label file is not found, an old birdnet model might be used
223223 cfg .LABELS_FILE = custom_classifier .replace ("Model_FP32.tflite" , "Labels.txt" )
224224
225- if not custom_classifier . endswith ( "Model_FP32.tflite" ) or not os .path .isfile (cfg .LABELS_FILE ):
225+ if not os .path .isfile (cfg .LABELS_FILE ): # if the label file is still not found, dont use labels
226226 cfg .LABELS_FILE = None
227227 cfg .LABELS = None
228228 else :
Original file line number Diff line number Diff line change @@ -605,10 +605,10 @@ def on_custom_classifier_selection_click():
605605 if not os .path .isfile (labels ):
606606 labels = file .replace ("Model_FP32.tflite" , "Labels.txt" )
607607
608- if not file . endswith ( "Model_FP32.tflite" ) or not os .path .isfile (labels ):
609- gr .Warning (loc .localize ("species-list-custom-classifier-no-labelfile-warning" ))
608+ if not os .path .isfile (labels ):
609+ gr .Warning (loc .localize ("species-list-custom-classifier-no-labelfile-warning" ))
610610
611- return file , gr .File (value = [file ], visible = True )
611+ return file , gr .File (value = [file ], visible = True )
612612
613613 return file , gr .File (value = [file , labels ], visible = True )
614614
You can’t perform that action at this time.
0 commit comments