Skip to content

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

Notifications You must be signed in to change notification settings

cloudacademy/sentiment-analysis-aws-lambda

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •