Skip to content

Commit dfd7dbc

Browse files
committed
only check for cellpose import if using python
1 parent 976e50a commit dfd7dbc

1 file changed

Lines changed: 14 additions & 14 deletions

File tree

active_plugins/runcellpose.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -578,20 +578,20 @@ def visible_settings(self):
578578
return vis_settings
579579

580580
def validate_module(self, pipeline):
581-
"""If using custom model, validate the model file opens and works"""
582-
from cellpose import models
583-
if self.mode.value == "custom":
584-
model_file = self.model_file_name.value
585-
model_directory = self.model_directory.get_absolute_path()
586-
model_path = os.path.join(model_directory, model_file)
587-
try:
588-
open(model_path)
589-
except:
590-
raise ValidationError(
591-
"Failed to load custom file: %s " % model_path,
592-
self.model_file_name,
593-
)
594-
if self.docker_or_python.value == "Python":
581+
if self.docker_or_python.value == "Python":
582+
"""If using custom model, validate the model file opens and works"""
583+
from cellpose import models
584+
if self.mode.value == "custom":
585+
model_file = self.model_file_name.value
586+
model_directory = self.model_directory.get_absolute_path()
587+
model_path = os.path.join(model_directory, model_file)
588+
try:
589+
open(model_path)
590+
except:
591+
raise ValidationError(
592+
"Failed to load custom file: %s " % model_path,
593+
self.model_file_name,
594+
)
595595
try:
596596
model = models.CellposeModel(pretrained_model=model_path, gpu=self.use_gpu.value)
597597
except:

0 commit comments

Comments
 (0)