Created
November 9, 2019 04:48
-
-
Save anupamchugh/10c232465f045c56b46a932e11f7b705 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
class ResultsObserver: NSObject, SNResultsObserving { | |
var delegate: GenderClassifierDelegate? | |
func request(_ request: SNRequest, didProduce result: SNResult) { | |
guard let result = result as? SNClassificationResult, | |
let classification = result.classifications.first else { return } | |
let confidence = classification.confidence * 100.0 | |
if confidence > 60 { | |
delegate?.displayPredictionResult(identifier: classification.identifier, confidence: confidence) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment