Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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