Skip to content

misha345a/Docker_Sentiment_Predictor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Docker Sentiment Predictor

docker-flask-flair

This project deploys a simple sentiment prediction interface using Flask and Docker.
Once a user enters a valid text input, sentiment is automatically predicted and displayed as POSITIVE or NEGATIVE along with the model's confidence score for that prediction.

Update:
The Docker image is now deployed to Heroku as well.
You can check out the full web app using this link:
http://flask-sentiment-predictor.herokuapp.com/ (just give the page a few seconds to load!)

Model

The text classification model is a pre-trained variation of BERT, which is downloaded and run using Flair - a powerful NLP library. This model has been trained on corpora from large sentiment datasets, including Amazon product reviews and movie reviews.

Usage

Docker is used to package the application, as well as the necessary libraries, to avoid conflicting system requirements and dependencies for other users.

The container image for this project can be pulled directly from Docker Hub.
Once you have Docker installed and set up, simply run the following command in the terminal:

docker run -dp 8000:8000 misha345a/flask_sentiment_predictor:latest

This will pull down the image from the registry and start the app.

Image

Once complete, view the Flask app with your browser on http://localhost:8000/.
If you are using Docker Toolbox, then you may have to visit the Toolbox VM’s private IP address instead.
Most likely, this address will be http://192.168.99.100:8000/. And if not, check for the correct IP using the docker-machine ip command.

As an easy alternative, you can also run the image using the same command on Docker's playground environment:
https://labs.play-with-docker.com/. A badge with the label 8000 will appear once the image is pulled. Click on it to launch the app.

Demo

Flask_App_Demonstration