Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


🧠 What is this?

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."


📰 Categories

Label Category
📰 World
Sports
💼 Business
🔬 Sci/Tech

✨ Features

  • 🧠 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 /docs via Swagger UI

🏗️ Project Structure

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

🚀 Getting Started

1. Clone the repository

git clone https://github.com/Abdelrahman-Noaman/Document-Classification.git
cd Document-Classification

2. Install dependencies

pip install -r requirements.txt

3. Start the app

python app.py

4. Open your browser

http://localhost:8000

5. Explore the API docs

http://localhost:8000/docs

🔌 API Endpoints

Single Classification

POST /classify
Content-Type: application/json

{
  "text": "NASA launches new satellite into orbit"
}

Response:

{
  "label": "Sci/Tech",
  "confidence": 0.97
}

Batch Classification

POST /classify/batch
Content-Type: application/json

{
  "texts": [
    "Stock markets hit record highs",
    "Brazil wins the World Cup"
  ]
}

🤖 Model Details

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

💡 What I Learned

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

👨‍💻 Author

Abdelrahman Noaman Mohammed

LinkedIn GitHub Gmail


"The best way to understand AI is to build with it."

About

AI-powered document classification dashboard using fine-tuned AG News model

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages