Create your own custom text classifier model and deploy it on an Android app using TensorFlow Lite.
Note: TF Lite Model Maker is now obsolete and is replaced by MediaPipe Model Maker. The below Colab notebook might therefore not work.
-
Clone the repository on your local machine.
-
Sign in to your Google account and upload the
Custom_Text_Classification.ipynb
notebook on Colab. -
Run the notebook cells one-by-one by following the instructions.
-
Once the TF Lite model is downloaded, copy the
.tflite
model file insideCustom-Text-Classification-on-Android-using-TF-Lite/Android_App/lib_task_api/src/main/assets
directory. -
Open the project in Android Studio and let it build itself for some time.
-
Open
TextClassificationClient.java
file underlib_task_api
and edit Line 31 by replacing<your_model.tflite>
with the name of your actual TF Lite model. -
Build the project and install it on your phone. Enjoy your own custom-build text classifier app.
Note: To build your custom dataset, refer the train.csv
file for the format.
- Read the Medium blog for step-by-step implementation.