I have already converted the .mlmodel
to .mlmodelc
, and I have put it in the resources folder. Im using Vision framework
and MNIST
model, following this tutorial (https://www.youtube.com/watch?v=bOg8AZSFvOc), but using swift playground.
What am i missing? (im using .playground files, not .playgroundbook files)
line of code:
guard let visionModel = try? VNCoreMLModel(for: MNIST().modelc) else {fatalError("can not load Vision ML model")}
Error message:
use of undefined identifier 'MNIST'
Screenshot:
Playground doesn't recognize the .mlmodel
file by default, so we need an iOS Project to help us find the compiled mlmodelc
folder, and copy the mlmodelc
folder to playground's resource folder, and the auto generated helper class to playground's source folder and change it to public. Then it works!
Try this project: https://github.com/DocRace/AnimalClassifier-Swift-Playground