TensorFlow.js Layers: Sentiment Analysis Demo


This example demonstrated loading a pre-trained model and using it in the browser. This model is trained to predict the sentiment of a short movie review (as a score between 0 and 1). The training is done server side using Python and then converted into a TensorFlow.js model.

The model is trained using IMDB reviews that have been truncated to a maximum of 200 words, only the 20000 most used words in the reviews are used. You can experiment with the model on this page or experiment with training your model by looking at the training code in the repository.

This is not intended to be a production level sentiment analysis model.

Load Model

Model type:
Vocabulary size:
Max length:

Input Sample


Standing by.