Created
May 12, 2018 18:56
-
-
Save an-indya/634a10bc956ab69d9fdb3430bc904d18 to your computer and use it in GitHub Desktop.
This file contains 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
let request = VNCoreMLRequest(model: model) { [weak self] (request, error) in | |
guard let results = request.results as? [VNClassificationObservation], | |
let topResult = results.first else { | |
fatalError("Result not in correct format") | |
} | |
DispatchQueue.main.async {[weak self] in | |
self?.predictionLabel.text = "\(topResult.confidence * 100)% | |
chance to be \(topResult.identifier)" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment