Swiftpack.co - mlfairy/mlfairy as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by mlfairy.
mlfairy/mlfairy 0.0.4
Improve your CoreML models with MLFairy
⭐️ 0
🕓 2 years ago
iOS macOS watchOS tvOS
.package(url: "https://github.com/mlfairy/mlfairy.git", from: "0.0.4")

MLFairy

codebeat badge Platforms

MLFairy gives developers the tools needed to better understand their CoreML models. It gives them the ability to update and deploy their latest CoreML model. MLFairy also gives you the ability to collect predictions from your model, so you can improve your model based on real-world results from your app.

Installation

MLFairy only supports Swift Package Manager, add the following to your Package.swift

.package(name: "MLFairy", url: "https://github.com/mlfairy/mlfairy.git", from: "0.0.3"),

Or add the following URL when adding the dependencies in Xcode through File > Swift Packages > Add Package Dependencies

https://github.com/mlfairy/mlfairy.git

Usage

Downloading the latest CoreML model

After installing MLFairy, you can access an API like this:

private let TOKEN = "<get your token from your account at www.mlfairy.com>"
let model = <Generated Class from .mlmodel file>()
MLFairy.getCoreMLModel(TOKEN) { response in
	switch (response.result) {
		case .success(let model):
			guard let model = model else {
				print("Failed to get CoreML model.")
				return
			}
			// Assign the returned model to your existing model
			// If you want to collect predictions, you can assign your model to response.mlFairyModel
			model.model = model
		case .failure(let error):
			print("Failed to get CoreML model \(String(describing: error)).")
	}
}

Automatically collect predictions

You can collect your model's predictions using MLFairy. You can do this with MLFairy.wrapCoreMLModel.

private let TOKEN = "<get your token from your account at www.mlfairy.com>"
let model = <Generated Class from .mlmodel file>()
model.model = MLFairy.wrapCoreMLModel(model.model, token: TOKEN)

Note: MLFairy.getCoreMLModel also returns an optional wrapped model if you are using MLFairy for model distribution.

License

MLFairy is released under an GPL-3 license. See License.txt for more information.

GitHub

link
Stars: 0
Last commit: 2 years ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

Version 0.0.4
2 years ago
  • [NEW] First Swift Package Manager release

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics