TFLite model for Android

Hello everyone!
I have created and trained a model for classifying spam in Russian SMS, but I do not understand how to integrate it into Android. I want to create an application so that a classification is performed on the click of a button. Can anyone help me please?

Hi @11140

What documentation have you tried so far?

I already have a tflite model. And I have Android Studio. I watched how similar tasks are implemented, but the models there were trained on a dataset with English-language messages, and I have SMS in Russian. Do you know I can write some kind of Java / Kotlin classifier for Russian text? Where can you read or see about it?

As you have used your model with python you can use it with Kotlin. For example usually for text classification you need to have a dictionary usually in your assets folder. This dictionary is going to be words and corresponding integers. Then you can convert your text in an array of integers that are going to be fed in the interpreter.

What is your approach inside python?

Here’s all my code.

I can also send a project from the Android Studio.

From what I saw in your notebook you have already followed the steps here (check them again if you like).
Inside there after conversion to tflite file they propose " This model can be integrated into an Android or an iOS app using the NLClassifier API of the TensorFlow Lite Task Library."
So basically from now on you can use directly the Task library for that. Follow this one and tell me how it goes, as I am a little sceptical about usage of russian language.

Tag me if you have more questions

Best

1 Like

This does not work for Russian

I presume then you have to do this the old way…
Custom Keras model for text classification with a dataset of your own.

Search online if there is russian text classification.