Last active
February 2, 2019 19:49
-
-
Save jamesonthecrow/1eb6960f7c05546858fbe4229461c93d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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