End-to-End MLOps Project for YouTube Comment Sentiment Analysis using a Chrome Extension, DVC, MLflow, AWS, and LightGBM
YouTube Sentiment Insights is an end-to-end Machine Learning + MLOps project that analyzes the sentiment of YouTube video comments and presents the results through a simple dashboard-like experience.
The project combines a traditional NLP/ML pipeline with MLOps best practices such as DVC for pipeline orchestration, MLflow for experiment tracking and model registry, AWS for remote artifact storage and deployment, and a Chrome extension frontend that interacts with the sentiment analysis API.
- Why This Project Exists
- Project Overview
- Features
- ML Workflow
- MLOps Workflow
- Tech Stack
- Project Structure
- How It Works
- Setup Instructions
- Future Improvements
- Acknowledgement
- Contact
YouTube comments contain a huge amount of user feedback, opinions, reactions, and sentiment. For creators, marketers, researchers, and even casual viewers, manually reading thousands of comments to understand the overall tone of a video is time-consuming and impractical.
- Videos often receive hundreds or thousands of comments
- Manually identifying whether the audience reaction is positive, negative, or neutral is inefficient
- There is no simple way to get a quick sentiment summary of a videoβs comment section
- Building an ML solution is only half the task β making it reproducible, trackable, and deployable is equally important
This project solves the problem by building a system that:
- Detects/open a YouTube video
- Extracts or sends comments for analysis
- Classifies comments into:
- 1 β Positive
- 0 β Neutral
- -1 β Negative
- Produces sentiment outputs that can be consumed by a Chrome extension / frontend
- Uses DVC + MLflow + AWS + CI/CD to make the entire workflow production-oriented and reproducible
This project follows a traditional Machine Learning NLP pipeline rather than an LLM-based approach.
The core idea is to train a sentiment classifier on a labeled Reddit sentiment dataset, then use that model to predict sentiment on YouTube comments through a lightweight application flow.
- Collect sentiment dataset for training
- Clean and preprocess text
- Train a sentiment classification model
- Track experiments with MLflow
- Version the ML pipeline with DVC
- Register the trained model
- Expose model predictions through a Flask API
- Use a Chrome extension frontend to interact with the API for YouTube sentiment analysis
- Dockerize + prepare AWS deployment + CI/CD workflow
- Analyze comments from a YouTube video
- Predict sentiment for each comment
- Classify into:
- Positive
- Neutral
- Negative
- Missing value handling
- Duplicate removal
- Empty text filtering
- Lowercasing
- Stopword removal
- Lemmatization
- Text normalization
- TF-IDF vectorization
- N-gram feature engineering
- LightGBM-based multi-class sentiment classifier
- Configurable hyperparameters using
params.yaml
- Log experiments and compare runs
- Track model performance
- Save artifacts remotely on AWS S3
- Register the final trained model in MLflow Model Registry
- Version-controlled ML pipeline
- Separate stages for:
- Data ingestion
- Data preprocessing
- Model building
- Model evaluation
- Easy reproducibility using DVC commands
- MLflow tracking server hosted on EC2
- Artifacts stored in S3
- AWS CLI used to connect local development environment with AWS resources
- Chrome extension frontend for interacting with the sentiment analysis system
- Designed to work with YouTube and show sentiment insights to the user
- Dockerized application setup
- GitHub Actions CI/CD workflow included
- Ready for cloud deployment and automation
| Layer | Technology |
|---|---|
| Language | Python |
| ML / NLP | Scikit-learn, NLTK, LightGBM |
| Feature Engineering | TF-IDF Vectorizer |
| Experiment Tracking | MLflow |
| Pipeline Orchestration | DVC |
| Backend API | Flask |
| Frontend | Chrome Extension (HTML, CSS/JS, Manifest) |
| Cloud | AWS EC2, AWS S3, AWS CLI |
| CI/CD | GitHub Actions |
| Serialization | Pickle |
| Data Handling | Pandas, NumPy |
| Config Management | YAML |
Youtube-Sentiment-Insights/
β
βββ .dvc/
βββ .github/
β βββ workflows/
β βββ cicd.yaml
β
βββ assets/
β βββ demo.gif
β
βββ data/
β βββ ...
β
βββ flask_app/
β βββ app.py
β βββ test.py
β
βββ notebooks/
β βββ ...
β
βββ src/
β βββ data/
β β βββ data_ingestion.py
β β βββ data_preprocessing.py
β β
β βββ model/
β βββ model_building.py
β βββ model_evaluation.py
β βββ register_model.py
β βββ __init__.py
β
βββ yt-chrome-plugin-frontend/
β βββ manifest.json
β βββ popup.html
β βββ popup.js
β
βββ .dvcignore
βββ .gitignore
βββ confusion_matrix_Test Data.png
βββ dvc.lock
βββ dvc.yaml
βββ experiment_info.json
βββ lgbm_model.pkl
βββ params.yaml
βββ README.md
βββ requirements.txt
βββ setup.py
βββ tfidf_vectorizer.pkl
The ML pipeline starts with the Reddit sentiment dataset.
- Ingest data
- Clean and preprocess comments
- Convert comments into TF-IDF features
- Train a LightGBM sentiment classifier
- Save the vectorizer and trained model
During training and evaluation:
- Metrics can be logged
- Artifacts can be stored
- The best model can be registered for downstream use
The Flask app loads:
tfidf_vectorizer.pkllgbm_model.pkl
Then it exposes prediction endpoints for inference.
The Chrome extension acts as the user-facing layer.
- User opens a YouTube video
- Extension UI is triggered
- Comments are extracted / passed to backend
- Flask API predicts sentiment
- Results are shown back to the user
During experimentation, the project followed a practical model improvement path.
- Random Forest baseline model
- Around 64% accuracy with 1000 features
- TF-IDF feature engineering
- Trigram features
- Tuning
max_features - Handling class imbalance using SMOTE
- Experimenting with stronger models such as:
- XGBoost
- Decision Trees
- LightGBM
- Traditional NLP + TF-IDF pipeline
- LightGBM classifier
- MLOps pipeline for reproducibility and deployment
Make sure you have the following installed:
- Python 3.9+ (recommended)
- Git
- pip
- DVC
- Docker (optional, for containerization)
- AWS CLI (if using remote MLflow / AWS setup)
- Google Chrome (for extension testing)
git clone https://github.com/Umer2900/Youtube-Sentiment-Insights.git
cd Youtube-Sentiment-InsightsWindows
python -m venv venv
venv\Scripts\activateMac/Linux
python3 -m venv venv
source venv/bin/activatepip install -r requirements.txtIf the DVC pipeline is configured and dependencies are available:
dvc reproFrom the project root, run:
python flask_app/app.pyThe API will typically run locally at: http://127.0.0.1:5000
i. Open Chrome and go to:
chrome://extensions/
ii. Enable Developer mode
iii. Click Load unpacked
iv. Select the folder:
yt-chrome-plugin-frontend/
Now the extension can be tested in Chrome.
dvc reproIf you want to replicate the MLOps setup used in this project, the general steps are:
Create AWS resources
- Create an IAM user
- Create an S3 bucket
- Launch an EC2 instance
Configure AWS CLI
Install and configure AWS CLI locally / on EC2:
aws configure
Add:
- AWS Access Key
- AWS Secret Key
- Region
- Output format
Start MLflow Server
Use the EC2 machine as the MLflow tracking server and S3 as artifact storage.
Note: Exact MLflow server commands may depend on your EC2 environment, bucket name, and tracking URI setup.
This project was built as an end-to-end MLOps + NLP + Deployment project covering:
- Traditional Machine Learning for NLP
- Text preprocessing and feature engineering
- Experiment tracking with MLflow
- DVC pipeline creation
- AWS integration
- Flask API development
- Chrome extension integration
- CI/CD and deployment concepts
It is designed as a hands-on project to demonstrate how a model moves from:
data β training β tracking β serving β frontend integration β deployment
Mohammad Umer Jan
B.Tech CSE | Data Science Enthusiast | MLOps & Machine Learning Learner
- GitHub: Umer2900
