AI-powered real-time content filtering for the web — browser extension + Flask API backend.
Content Guard is a full-stack content moderation system built as a graduation project at Ain Shams University (Faculty of Computer and Information Sciences). It combines a fine-tuned machine learning classification model with a lightweight Flask API and a Chrome browser extension to automatically detect and blur/block sensitive or inappropriate content — in real time, as users browse.
The system was designed around the challenge of making AI-driven content moderation accessible at the client level, without requiring server-side infrastructure on the part of websites being visited.
┌─────────────────────────┐ ┌──────────────────────────────┐
│ Chrome Extension │ │ Flask Classification API │
│ (JavaScript/HTML/CSS) │──POST──▶│ (Python / ML Model) │
│ │◀──JSON──│ │
│ • Intercepts page text │ │ • Receives text payload │
│ • Blurs/blocks content │ │ • Runs inference │
│ • User toggle controls │ │ • Returns label + confidence│
└─────────────────────────┘ └──────────────────────────────┘
Repos:
Content_Filter_Extension_Backend— Flask API & ML model (this repo)Content_Filter_chrome_Extension— Chrome extension frontend
- 98% classification accuracy on the test set across sensitive content categories
- Real-time inference — content is evaluated and filtered on page load without perceptible lag
- Automatic blur/block — the extension blurs flagged content and gives the user the option to reveal or permanently dismiss
- Configurable thresholds — confidence threshold for triggering blur can be tuned via extension settings
- Large-scale training data — model trained on a curated, merged dataset assembled from multiple public sources to maximize generalization
| Layer | Technology |
|---|---|
| ML Model | Python, scikit-learn / TensorFlow (see model notes) |
| API Server | Flask, REST |
| Data Pipeline | Pandas, NumPy |
| Browser Extension | Vanilla JavaScript, HTML, CSS, Chrome Extensions API (Manifest V3) |
| Deployment | Deployable on any WSGI-compatible host (e.g., Render, Railway, Heroku) |
- Python 3.10+
- pip
- Google Chrome (for the extension)
git clone https://github.com/Andrew-A-A/Content_Filter_Extension_Backend.git
cd Content_Filter_Extension_Backend
pip install -r requirements.txtpython app.pyThe API will start on http://localhost:5000 by default.
POST /classify
// Request
{
"text": "Content string to classify"
}
// Response
{
"label": "safe", // or "sensitive"
"confidence": 0.97
}- Clone the extension repo
- Open Chrome and navigate to
chrome://extensions - Enable Developer Mode (top right)
- Click Load unpacked and select the cloned extension folder
- Ensure the backend API is running and the extension points to the correct API URL
The classification model was built to detect sensitive/inappropriate content in text. Key decisions in the pipeline:
- Data curation: Multiple public datasets were merged and deduplicated to improve coverage across content domains and writing styles
- Preprocessing: Standard NLP pipeline — tokenization, stopword removal, and vectorization
- Evaluation: Achieved 98% accuracy on the held-out test set, with balanced performance across classes
For full training notebooks and dataset sources, see the
/notebooksdirectory.
This project was developed as the graduation project for the Bachelor's in Computer Science at Ain Shams University (Oct 2023 – Jul 2024). The goal was to explore practical, client-side deployment of content moderation AI — a real problem faced by parents, educators, and organizations who want protection without relying on platform-level filtering.