Montblanc
Montblanc is a wrapper for CoreML Model Compiler. Montblanc written in Swift
Requirements
- Swift 4.1 or later
Usage
- Fetch
.mlmodel
from remote & compile
import Montblanc
let url = URL(string: "https://docs-assets.developer.apple.com/coreml/models/MobileNet.mlmodel")!
Montblanc.request(url) { result in
switch result {
case .success(let model):
// return compiled CoreML model
case .failure(let error):
Swift.print(error)
}
}
- Compile local
.mlmodel
file
import Montblanc
let path = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first!.appendPathComponent("your_file.mlmodel", isDirectory: false)
Montblanc.compile(path) { result in
switch result {
case .success(let model):
// return compiled CoreML model
case .failure(let error):
Swift.print(error)
}
}
Installation
Carthage
Add the following to your Cartfile
:
github "natmark/Montblanc"
License
Montblanc is available under the MIT license. See the LICENSE file for more info.