Skip to content

Commit a936a47

Browse files
committed
🐛 fix(auto_labeling): prevent crashes on auto_labeling shortcuts when no model is loaded
1 parent b74f634 commit a936a47

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

anylabeling/views/labeling/widgets/auto_labeling/auto_labeling.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -832,6 +832,7 @@ def run_prediction(self):
832832
if (
833833
self.button_skip_detection.isChecked()
834834
and self.parent.canvas.shapes
835+
and self.model_manager.loaded_model_config
835836
and self.model_manager.loaded_model_config["type"]
836837
in _SKIP_DET_MODELS
837838
):
@@ -1119,6 +1120,8 @@ def on_new_marks(self, marks):
11191120
self.model_manager.set_auto_labeling_marks(marks)
11201121
if self.skip_auto_prediction:
11211122
return
1123+
if not self.model_manager.loaded_model_config:
1124+
return
11221125
current_model_name = self.model_manager.loaded_model_config["type"]
11231126
if current_model_name not in _SKIP_PREDICTION_ON_NEW_MARKS_MODELS:
11241127
self.run_prediction()
@@ -1613,7 +1616,8 @@ def on_clear_clicked(self):
16131616

16141617
# Adaptation for Segment Anything 3 Video Integration
16151618
if (
1616-
self.model_manager.loaded_model_config.get("type")
1619+
self.model_manager.loaded_model_config
1620+
and self.model_manager.loaded_model_config.get("type")
16171621
== "remote_server"
16181622
):
16191623
if self.model_manager.loaded_model_config["model"].models_info.get(

0 commit comments

Comments
 (0)