diff --git a/src/main/java/io/bioimage/modelrunner/bioimageio/description/ModelDescriptorFactory.java b/src/main/java/io/bioimage/modelrunner/bioimageio/description/ModelDescriptorFactory.java index 978cb456..7ebad5cf 100644 --- a/src/main/java/io/bioimage/modelrunner/bioimageio/description/ModelDescriptorFactory.java +++ b/src/main/java/io/bioimage/modelrunner/bioimageio/description/ModelDescriptorFactory.java @@ -66,6 +66,7 @@ public static ModelDescriptor readFromLocalFile(String modelFile) throws ModelSp Map yamlElements = YAMLUtils.load(modelFile); // TODO yamlElements.put(fromLocalKey, true); // TODO yamlElements.put(modelPathKey, new File(modelFile).getParent()); + yamlElements.put("modelPath", new File(modelFile).getParentFile().getAbsolutePath()); return fromMap(yamlElements); } @@ -162,11 +163,9 @@ protected static List buildUrlElements(Object coverElements) List elems = (List) coverElements; for (Object elem : elems) { - if (checkUrl((String) elem) == null) - continue; covers.add((String) elem); } - } else if ((coverElements instanceof String) && checkUrl((String) coverElements) != null) { + } else if ((coverElements instanceof String)) { covers.add((String) coverElements); } else { covers = null; diff --git a/src/main/java/io/bioimage/modelrunner/bioimageio/download/DownloadModel.java b/src/main/java/io/bioimage/modelrunner/bioimageio/download/DownloadModel.java index 379370d5..2b8e3eb5 100644 --- a/src/main/java/io/bioimage/modelrunner/bioimageio/download/DownloadModel.java +++ b/src/main/java/io/bioimage/modelrunner/bioimageio/download/DownloadModel.java @@ -232,6 +232,7 @@ private void retriveDownloadModelLinks() { downloadableLinks = new HashMap(); addAttachments(); addRDF(); + addCovers(); addSampleInputs(); addSampleOutputs(); addTestInputs(); @@ -286,6 +287,19 @@ private void addWeights() { } } + /** + * Add the model covers to the downloadable links + */ + private void addCovers() { + int c = 0; + for (String ss : descriptor.getCovers()) { + if (!checkURL(ss)) + downloadableLinks.put(TEST_INPUTS_KEY + "_" + c ++, this.descriptor.getModelURL() + ss); + else + downloadableLinks.put(TEST_INPUTS_KEY + "_" + c ++, ss); + } + } + /** * Add the test inputs to the downloadable links */