Flask Sentiment Analysis App
120
This project is a Flask-based Sentiment Analysis Web Application that uses Machine Learning to classify user-provided text (tweets, reviews, comments) into Positive or Negative sentiment. Itβs designed to be lightweight, containerized using Docker, and deployable on any cloud platform like AWS EC2.
π― Main Aim The goal of this project is to:
sentiment-app/
βββ Dockerfile # Docker build instructions
βββ requirements.txt # Python dependencies
βββ sent.py # Main Flask application
βββ tfidf1_tweets.pkl # Pre-trained TF-IDF vectorizer
βββ NaiveBayes_Tweets.pkl # Pre-trained Naive Bayes model
βββ templates/
βββ index.html # Frontend HTML page
- Git
- Docker installed and running
- Docker Hub account
git clone https://github.com/raghottam465/sentiment-app.git
cd sentiment-app
## β
Step 1: SSH into EC2 (Replace with your actual .pem and public IP)
ssh -i your-key.pem ec2-user@your-ec2-public-ip
## β
Step 2: Install Docker using yum
sudo yum update -y
sudo yum install docker -y
## β
Step 3: Start and enable Docker service
sudo systemctl start docker
sudo systemctl enable docker
## β
Step 4: Add ec2-user to docker group (logout and login again after this)
sudo usermod -aG docker ec2-user
## β οΈ Important: After running the command above, log out and SSH again to apply the group change:
exit
## Then reconnect:
ssh -i your-key.pem ec2-user@your-ec2-public-ip
pip install -r requirements.txt
python sent.py
docker build -t sentiment-app .
docker run -d -p 5000:5000 sentiment-app
docker login
docker tag sentiment-app raghottam465/sentiment-app:latest
docker push raghottam465/sentiment-app:latest
docker pull <username>/sentiment-app:latest
docker run -d -p 5000:5000 <username>/sentiment-app
| Category | Library/Tool | Purpose |
|---|---|---|
| Backend | Flask | Web framework for Python |
| ML/NLP | Scikit-learn | Naive Bayes classifier & TF-IDF vectorizer |
| Pickle | Model serialization (load .pkl files) | |
| Web | HTML, Jinja2 | Frontend interface with Flask templates |
| Container | Docker | Containerization of app |
| Deployment | AWS EC2 (Ubuntu) | Cloud hosting for Docker container |
click here : https://hub.docker.com/r/raghottam465/sentiment-appβ
Content type
Image
Digest
sha256:2ddf50092β¦
Size
254.3 MB
Last updated
about 1 year ago
docker pull raghottam465/sentiment-app