Skip to content

Commit

Permalink
use absolute path and correct errors with spaces in macros
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosuc3m committed Nov 13, 2024
1 parent de83cd7 commit 5f9b554
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions .github/create_macro.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
def is_model_supported_on_os(descriptor):
modelWeights = descriptor.getWeights().gettAllSupportedWeightObjects()
for ww in modelWeights:
print(ww.getFramework(), ww.getTrainingVersion())
isAvailable = AvailableEngines.isEngineSupportedInOS(ww.getFramework(), ww.getTrainingVersion(), None, None)
if isAvailable:
return True
Expand Down Expand Up @@ -90,7 +91,7 @@ def parse_model_paths(models):
for model in model_nicknames:
print("Downloading the Bioimage.io model: " + model.strip())
model_dir = br.downloadModelByID(model.strip(), models_dir)
models_full_path.append(model_dir)
models_full_path.append(os.path.abspath(model_dir))

## Create macros

Expand All @@ -109,7 +110,10 @@ def parse_model_paths(models):
continue
convert_npy_to_tif(mfp, test_name, descriptor.getInputTensors().get(0).getAxesOrder())
sample_name = CREATED_SAMPLE_NAME
macro = MACRO_STR.format(model_path=mfp, input_path=os.path.join(mfp, sample_name), output_folder=mfp)
if mfp.contains(" "):
macro = MACRO_STR.format(model_path="[" + mfp + "]", input_path="[" + os.path.join(mfp, sample_name) + "]", output_folder="[" + mfp + "]")
else:
macro = MACRO_STR.format(model_path=mfp, input_path=os.path.join(mfp, sample_name), output_folder=mfp)
file.write(macro + os.linesep)

name_without_extension = sample_name[:sample_name.rfind(".")]
Expand Down

0 comments on commit 5f9b554

Please sign in to comment.