elijah-dayan / sentiment-analysis-aws-lambda

How to deploy a Machine Learning model for sentiment analysis in the Cloud with AWS Lambda.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sentiment analysis in the Cloud with AWS Lambda.

The Cloud Academy team shows how to build a sentiment analysis machine learning model by using a pubic dataset and how to deploy it to production with AWS Lambda and API Gateway.

Frontend Screenshot

How to install requirements

OS libraries can be installed as follows (Linux):

$ sudo yum install -y atlas-devel atlas-sse3-devel blas-devel gcc gcc-c++ lapack-devel python27-devel

Python requirements can be installed with pip.

$ pip install -r requirements.txt

Training phase

You can train and persist the model into file by executing:

$ python main.py

Test the model locally

You can run the model via CLI as follows:

$ python predict.py "This function is awesome"
> positive

How to deploy the Lambda function

Simply execute the following deployment script:

$ ./deploy.sh

It will automatically create a new deployment package containing every Python dependency and the OS libraries required by scikit-learn and numpy, together with the "lambda" folder.

Here you can find the whole stack ready to be uploaded (reference).

Once the deployment package is ready, you can create a new AWS Lambda function and bind it to a new Amazon API Gateway endpoint.

References

About

How to deploy a Machine Learning model for sentiment analysis in the Cloud with AWS Lambda.


Languages

Language:Python 58.0%Language:HTML 22.3%Language:Shell 11.0%Language:JavaScript 6.3%Language:CSS 2.3%