Deploy sentiment anaysis deep learning model using flask. It allows you using the result of model prediction through REST API
$ git clone https://github.com/JDhyeok/falsk-ml-model-api.git
- Docker (Optional)
- Tensorflow
- Keras
- Python >= 3.x
-
Setup virtual environment
$ virtualenv venv
-
Start python virtual environment
$ .\venv\Script\activate # or source .\venv\Script\activate
-
Install dependencies
$ pip install -r requirements
-
Start Flask server
$ cd app $ flask run
-
Build docker image
$ docker-compose build
-
Start docker container
$ docker-compose up
You can use cURL examples below or use third party application such as PostMan.
-
api test
$ curl http://localhost:5000/api
-
Predict sentiment score
$ curl -X GET -H "Content-Type: application/json" --data '{"contents":"It is the best movie i've ever seen in my whole life"}' http://localhost:5000/api/predict
-
Response JSON example
{ sentiment: "Positive" score: 95.1245 }
http://ai.stanford.edu/~amaas/papers/wvSent_acl2011.pdf
https://www.kaggle.com/lakshmi25npathi/sentiment-analysis-of-imdb-movie-reviews