News Bias Dashboard
Python
Flask
PyTorch
Hugging Face
SQLAlchemy
SQLite
Next.js
TypeScript
Tailwind CSS
Chrome Extensions
Cloudflare Tunnel
Vercel
pytest

A full-stack platform that analyses political news articles for bias, sentiment and subjectivity using custom-trained machine learning models, with a Chrome extension for data capture, a Flask API, and a Next.js dashboard comparing coverage across six major outlets.
There was no news API I could access, so I built my own way of collecting data: a Chrome extension (Manifest V3) that captures the article a user is already reading. It pulls the title, date, body and metadata from the page and sends them to the backend over an authenticated REST endpoint. Each outlet structures its pages differently, so the extension uses outlet-specific parsing, for example reading meta tags to tell opinion pieces apart from news.
I trained two RoBERTa models with PyTorch and Hugging Face Transformers on a local GPU: one detects biased language and the other measures subjectivity. I ran structured hyperparameter sweeps over 40 training runs to choose each model's configuration on evidence rather than guesswork. The bias model ended up outperforming published benchmarks on the same dataset. Both models score text sentence by sentence, so the dashboard can highlight exactly which sentences drove an article's score.
The Flask backend runs a four-stage NLP pipeline and stores results in a relational SQLite schema (Outlet, Article, SentenceScore and Topic tables) through SQLAlchemy. Topic classification uses a locally hosted LLM, which is slow, so I moved it onto a background thread. The API responds right away and the topic is written to the database once it's ready. The backend is covered by 93 automated tests, using pytest fixtures that mock the ML models and spin up a fresh in-memory database for each test.
The frontend is deployed on Vercel. The backend needs a GPU, so rather than paying for cloud GPU hosting I kept it on my own machine and exposed it securely through a Cloudflare Tunnel, served with Waitress. I secured the write endpoint with an API key that fails closed if it isn't configured and is checked with a timing-safe comparison, plus rate limiting. The dashboard fetches all its data in Next.js Server Components, which avoids CORS issues. It includes interactive Recharts visualisations, client-side filtering, and error handling that keeps pages usable if the backend goes offline.
View on GitHub