Skip to content

Latest commit

 

History

History
52 lines (27 loc) · 2.14 KB

README.md

File metadata and controls

52 lines (27 loc) · 2.14 KB

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