YouTube Sentiment MLOps Pipeline
Chrome extension and FastAPI service that classify the sentiment of YouTube comments as positive, neutral or negative with a TF-IDF and Logistic Regression pipeline.
- Python
- Scikit-learn
- NLTK
- Pandas
- FastAPI
- Docker
- GitHub Actions
- Pytest
- JavaScript
Problem
Understand what viewers think about a YouTube video without reading thousands of comments.
Approach
A Manifest V3 Chrome extension scrapes up to 50 loaded comments from the YouTube page and sends them in a single batch request to a Dockerized FastAPI service. The service cleans the text with a custom NLTK pipeline that keeps negation words, runs it through a TF-IDF (1-2 grams) and Logistic Regression model, and the extension shows the aggregated positive, neutral and negative breakdown. The Dockerfile pre-downloads the NLTK data at build time, and GitHub Actions runs the pytest suite on every push and pull request.
Architecture
Chrome extension (Manifest V3) -> POST /predict_batch -> FastAPI service in Docker -> text cleaning -> TF-IDF + Logistic Regression -> aggregated sentiment shown in the extension.
Results
| Metric | Verified Value | Context |
|---|---|---|
| Quality gates | pytest suite runs on every push and pull request through GitHub Actions | — |
What I Learned
Chose TF-IDF with Logistic Regression over a heavier deep-learning model for speed and low memory use, kept negation words such as "not" during text cleaning so that "this video is not good" is not read as positive, and used one batch endpoint instead of 50 separate requests.