Skip to content

777advait/imdb_sentiment_analysis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NLP Challenge - IMDB Dataset of 50K Movie Reviews to perform Sentiment analysis

This solution is based on the IMDB Dataset of 50K Movie Reviews. The dataset is used to perform sentiment analysis on the movie reviews. The trained model is served as a REST API using FastAPI and dockerized using Docker.

You can find the API hosted at https://sentiment-analysis.astro-dev.tech

Tech Stack

  • Python 3.12
  • Scikit-learn
  • Pandas
  • FastAPI
  • Docker

Training the Model

The model is trained using a dataset of 50K IMDB reviews:

  • Open the app/sentiment_analysis.ipynb notebook.
  • Follow the steps for Exploratory Data Analysis (EDA) and model training.
  • Save the trained model and vectorizer as .pkl files in the models directory.

API endpoints

  • GET /: Returns a welcome message
  • POST /analyze/: Perform sentiment analysis on the input text

Installation

Make sure to execute all the cells in the notebook (app/sentiment_analysis.ipynb) sequentially to train and save the model before running the API.

Using docker

  1. Build the docker image
docker build -t imdb-sentiment-analysis .
  1. Run the docker image
docker run -p 8000:8000 imdb-sentiment-analysis
  1. Access the API
http POST localhost:8000/analyze input_text="i really like react hooks" --follow

Using pip

  1. Install the requirements
pip install -r requirements.txt
  1. Run the app
python app/main.py
  1. Access the API
http POST localhost:8000/analyze input_text="i really like react hooks" --follow

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published