Skip to content

Instantly share code, notes, and snippets.

@iosdevie
Created May 26, 2021 05:50
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 iosdevie/cae9a7dd9e9b6bd70664dec188de975d to your computer and use it in GitHub Desktop.
Save iosdevie/cae9a7dd9e9b6bd70664dec188de975d to your computer and use it in GitHub Desktop.
private func loadModel(url: URL) -> MLModel? {
do {
let config = MLModelConfiguration()
config.computeUnits = .all
return try MLModel(contentsOf: url, configuration: config)
} catch {
print("Error loading model: \(error)")
return nil
}
}
let modelURL = Bundle.main.url(forResource: "CatDogUpdatable", withExtension: "mlmodelc")
let updatableModel = loadModel(url: modelURL)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment