Skip to content

Instantly share code, notes, and snippets.

@Shashikant86
Created February 3, 2019 21:07
Show Gist options
  • Save Shashikant86/4f0fec0f1d8985b7854243271e4e30b4 to your computer and use it in GitHub Desktop.
Save Shashikant86/4f0fec0f1d8985b7854243271e4e30b4 to your computer and use it in GitHub Desktop.
CreateML Swift Script
import Foundation
import CreateML
let training = URL(fileURLWithPath: "/tmp/ml/data-applenews/training")
let testing = URL(fileURLWithPath: "/tmp/ml/data-applenews/training")
let model = try MLImageClassifier(trainingData: .labeledDirectories(at: training))
let evaluation = model.evaluation(on: .labeledDirectories(at: testing))
try model.write(to: URL(fileURLWithPath: "/tmp/ml/data-applenews/applemews.mlmodel"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment