Skip to content

Instantly share code, notes, and snippets.

@gali8
Created September 15, 2017 16:11
Show Gist options
  • Save gali8/0da3bd11f2e0ddf58918c1679cce06c0 to your computer and use it in GitHub Desktop.
Save gali8/0da3bd11f2e0ddf58918c1679cce06c0 to your computer and use it in GitHub Desktop.
func predictImageUIGraphics(image: UIImage) {
let (pixelBuffer, _) = image.pixelBuffer()
guard let pixels = pixelBuffer else {
self.resetOnError()
return
}
self.lblGender?.text = analyzing
if let predGender = try? gender.prediction(data: pixels) {
self.setGender(prob: predGender.prob)
}
else {
self.lblGender?.text = unknown
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment