A lightweight yet powerful AI dashboard that classifies any news article into one of four categories in real time — using a fine-tuned Transformer model trained on the AG News dataset.
"I got tired of reading the news. So I built an AI to categorize it for me."
| Label | Category |
|---|---|
| 📰 | World |
| ⚽ | Sports |
| 💼 | Business |
| 🔬 | Sci/Tech |
- 🧠 Real-time text classification — instant predictions on any input
- 📊 Confidence scoring — know exactly how sure the model is
- 📦 Batch classification — classify multiple texts at once via
/classify/batch - ⚡ FastAPI backend — fast, clean, and production-ready
- 🎨 Responsive dashboard UI — polished editorial design, works on any screen
- 📄 Auto-generated API docs — available at
/docsvia Swagger UI
Document-Classification/
│
├── app.py # FastAPI backend & model loading
├── requirements.txt # Python dependencies
├── static/
│ ├── index.html # Frontend dashboard
│ ├── styles.css # UI styling
│ └── app.js # Frontend logic
└── ag_news_finetuned_model/ # Fine-tuned Transformer model
git clone https://github.com/Abdelrahman-Noaman/Document-Classification.git
cd Document-Classificationpip install -r requirements.txtpython app.pyhttp://localhost:8000
http://localhost:8000/docs
POST /classify
Content-Type: application/json
{
"text": "NASA launches new satellite into orbit"
}Response:
{
"label": "Sci/Tech",
"confidence": 0.97
}POST /classify/batch
Content-Type: application/json
{
"texts": [
"Stock markets hit record highs",
"Brazil wins the World Cup"
]
}| Property | Value |
|---|---|
| Base Model | DistilBERT / BERT (fine-tuned) |
| Dataset | AG News |
| Classes | 4 (World, Sports, Business, Sci/Tech) |
| Framework | Hugging Face Transformers + PyTorch |
| Serving | FastAPI |
Fine-tuning a Transformer model forces you to think differently. You stop seeing text as words and start seeing it as patterns, weights, and probabilities. When the model gets it wrong, you do not just fix a bug — you rethink the whole approach.
This project gave me deep hands-on experience in:
- NLP and Transformer fine-tuning
- REST API design with FastAPI
- AI model deployment and serving
- Building production-grade AI dashboards