Predict
let input = coffee_predictionInput(input: mlMultiArray) | |
guard let prediction = try? model.prediction(input: input) else { | |
return | |
} | |
let result = prediction | |
print("classLabel \(result.classLabel)") | |
if result.classLabel == 1 { | |
self.class_image.image = UIImage.init(named: "coffee_hot") | |
self.predict_label.text = "Hot Coffee" | |
} else { | |
self.class_image.image = UIImage.init(named: "coffee_iced") | |
self.predict_label.text = "Iced Coffee" | |
} | |
let percent = Int(round(result.classProbability[result.classLabel]! * 100)) | |
self.predict_label.text = self.predict_label.text! + "\n(\(percent)% probability)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment