Skip to content

Instantly share code, notes, and snippets.

@jamesonthecrow
Last active February 2, 2019 19:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamesonthecrow/1eb6960f7c05546858fbe4229461c93d to your computer and use it in GitHub Desktop.
Save jamesonthecrow/1eb6960f7c05546858fbe4229461c93d to your computer and use it in GitHub Desktop.
import Fritz
// Fetch all of the models matching the tag
// we chose based on the machine identifier
let tagManager = ModelTagManager(tags: [tag])
// Loop through all of the models returned and download each model.
// In this case, we should only have a single model for each tag.
var allModels: [FritzMLModel] = []
tagManager.fetchManagedModelsForTags { managedModels, error in
guard let fritzManagedModels = managedModels, error == nil else {
return
}
for managedModel in fritzManagedModels {
// Verify the model we get back has the correct tags.
print("Model ID: " + managedModel.activeModelConfig.identifier + " Tags: " + managedModel.activeModelConfig.tags![0])
managedModel.fetchModel { downloadedModel, error in
guard let fritzMLModel = downloadedModel, error == nil else {
return
}
allModels.append(fritzMLModel)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment