Created
September 18, 2017 02:41
-
-
Save sonsongithub/a5dfab82414c44f02ee0e78c0d0dc27c to your computer and use it in GitHub Desktop.
How to update Core ML model with a file in Document directory.
This file contains hidden or 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
| do { | |
| // You have to add the file whose name is changed from KerasMNIST.mlmodel to KerasMNIST.bin to app target. | |
| // In order to avoid that Xcode compiles a mlmodel file automatcally. | |
| guard let url = Bundle.main.url(forResource: "KerasMNIST", withExtension: "bin") else { return } | |
| let compiledURL = try MLModel.compileModel(at: url) | |
| print(compiledURL) | |
| let model = try MLModel(contentsOf: compiledURL) | |
| print(model) | |
| } catch { | |
| print(error) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment