gitmyhub

BrainJSReactNative

JavaScript ★ 30 updated 7y ago

An example React Native mobile app that uses a JavaScript neural network to classify song lyrics as either Lee Kernaghan or AC/DC, running entirely on the phone with a pre-trained model.

JavaScriptReact Nativebrain.jssetup: moderatecomplexity 2/5

This project is an example app showing how to run a neural network directly inside a React Native mobile app. Specifically, it demonstrates a phone app that can guess whether a song's lyrics belong to Lee Kernaghan or AC/DC. It is built using brain.js, a JavaScript library for neural networks, and serves as a tutorial for developers who want to add machine learning to their own mobile apps.

At a high level, the project includes two main pieces. First, a script that learns patterns from 20 different songs to tell the two artists apart. Second, a working mobile app interface where a user can type in lyrics, and the app classifies which artist likely wrote them. The project also includes a pre-trained model file, so you can run the app immediately without going through the training process yourself.

A mobile developer or hobbyist learning machine learning would use this to understand how to bring basic AI into a React Native app. The concrete use case is a text classification tool that reads lyrics and predicts the original artist. Rather than relying on a remote server to do the thinking, the app handles the pattern recognition entirely on the phone using a multi-layer neural network.

The project highlights a specific tradeoff in how it handles the machine learning process. Training a model requires extra code dependencies that mobile apps do not naturally support. To solve this, the project separates the work: the model is trained on a computer beforehand, and only the finished model is loaded onto the phone to make predictions. This means the app stays lightweight, but users cannot train new models directly on their devices.

Where it fits