This project allows a user to provide their review regarding a movie and using Sentimental Analysis, the underlying model predicts whether the review is positive or negative. The training model is trained using Pytorch NN and training data used is IMDB review dataset available at https://www.kaggle.com/utathya/imdb-review-dataset.
Clone this repo to your local machine by typing the following command :
$ git clone `https://github.com/mehtajinesh/Sentimental-Analysis-using-NN.git`
Things to install before starting :
Python 3.7 'https://www.python.org/downloads/release/python-370/'
pip install awscli
once the installation is done, configure the system with your aws_key_id, aws_key and region by doing the following:
- First step is to install all the modules required to run the python code into your local system. Use the following command:
$ pip install -r requirements.txt
- Once all the modules are installed, then download the IMDB dataset and extract folders for training the model.
%mkdir ../data !wget -O ../data/aclImdb_v1.tar.gz http://ai.stanford.edu/~amaas/data/sentiment/aclImdb_v1.tar.gz !tar -zxf ../data/aclImdb_v1.tar.gz -C ../data
- Next, we combine the training and deployment (elaborated below) inside the main.py file :
training model by fitting the data to pytorch model
deploy the trained model on sagemaker which will constantly interact with the AWS Lambda function
So for training the model, we execute the main.py file like this :
Once the execution is done, it will print out the deployed model name, which is provided to the AWS Lambda function.
Next, we create a AWS API Gateway which will communicate to the AWS Lambda function whenever a submit request comes.
Once the API is ready, we update the URL inside the index.html file and voila! We are good to go!!
- Python - The web framework used
- AWS SageMaker - where the trained model are deployed
- AWS Lambda - where the prediction is done using trained model
- AWS S3 - where the model artifacts are stored
- AWS API Gateway - where the url hits on click of submit
- Jinesh Mehta
Reviews & Validations
- From Udacity