Skip to content

Commit b56bb11

Browse files
authored
Fix labels not being read when using cc (#767)
1 parent 24dc792 commit b56bb11

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

birdnet_analyzer/analyze/core.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff 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:

birdnet_analyzer/gui/utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)