Message Filtering with CoreML

Hi there,

I am trying to create a Message Filter app that uses a trained Text Classification to predict scam texts (as it is common in my country and is constantly evolving).

However, when I try to use the MLModel in the MessageFilterExtension class, I'm getting

initialization of text classifier model with model data failed

Here's how I initialize my MLModel that is created using Create ML.

do {
    let model = try MyModel(configuration: .init())
    let output = try model.prediction(text: text)
            
    guard !output.label.isEmpty else {
        return nil
    }
            
    return MessagePrediction(rawValue: output.label)
} catch {
    return nil
}

Is it impossible to use CoreML in Message Filter extensions?

Thank you

I don't see any obvious error in your code. The error message suggests that Core ML is failing to instantiate a classifier of NaturalLanguage.framework for some reason.

For the further analysis, we need a feedback assistant report (https://feedbackassistant.apple.com) with reproducible sample code.

Message Filtering with CoreML
 
 
Q