Skip to content

Commit

Permalink
add way for teh mdoel to know ehere it is and download cover images when
Browse files Browse the repository at this point in the history
downloading model
  • Loading branch information
carlosuc3m committed Oct 8, 2024
1 parent 02d2aa6 commit 09c579c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public static ModelDescriptor readFromLocalFile(String modelFile) throws ModelSp
Map<String, Object> 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);
}

Expand Down Expand Up @@ -162,11 +163,9 @@ protected static List<String> 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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ private void retriveDownloadModelLinks() {
downloadableLinks = new HashMap<String, String>();
addAttachments();
addRDF();
addCovers();
addSampleInputs();
addSampleOutputs();
addTestInputs();
Expand Down Expand Up @@ -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
*/
Expand Down

0 comments on commit 09c579c

Please sign in to comment.