Skip to content

Latest commit

 

History

History
44 lines (30 loc) · 1.57 KB

File metadata and controls

44 lines (30 loc) · 1.57 KB

TensorFlow Lite Text Classification Android Demo

Overview

This sample will accept text entered into a field and classify it as either positive or negative with a provided confidence score. The supported classification models include Word Vector and MobileBERT, both of which are generated using TensorFlow's Model Maker. These instructions walk you through building and running the demo on an Android device.

The model files are downloaded via MSBuild scripts when you build and run the app. You don't need to do any steps to download TFLite models into the project explicitly.

Build the demo using Visual Studio

Prerequisites

  • The Visual Studio IDE. This sample has been tested on Mac Visual Studio 2022.

  • A physical or emulated Android device with a minimum OS version of SDK 21 (Android 5.0) with developer mode enabled. The process of enabling developer mode may vary by device.

Building

  • Open Visual Studio. From the Welcome screen, select Open a local Visual Studio project, solution, or file.

  • From the Open File or Project window that appears, navigate to and select the TensorFlowLiteExamples/TextClassification solution. Click Open.

  • With your Android device connected to your computer and developer mode enabled, click on the black Run arrow in Visual Studio.

Models used

Downloading, extraction, and placing the models into the assets folder is managed automatically by the TextClassification.csproj file.