An NLP-based machine learning model that automatically classifies customer complaints into predefined categories, enabling faster and more accurate complaint routing.
Manual complaint sorting is slow and inconsistent. This project uses natural language processing to automatically categorize incoming complaints — helping route them to the right department faster and reducing manual workload.
- Classifies complaints into 4 categories: Water, Electricity, Roads, Sanitation
- TF-IDF vectorization + Naive Bayes classification model
- FastAPI backend for serving predictions
- Streamlit dashboard for an interactive user interface
- Admin correction panel to fix misclassified complaints
- Prediction history export for tracking and analysis
- Language: Python
- ML/NLP: scikit-learn (TF-IDF, Naive Bayes)
- Backend: FastAPI
- Frontend: Streamlit
- Data handling: Pandas
-
Clone the repository
git clone https://github.com/maha-434/complaint-classifier.git cd complaint-classifier -
Install dependencies
pip install -r requirements.txt
-
Train the model
python train.py
-
Run the FastAPI backend
uvicorn app:app --reload
-
Run the Streamlit dashboard (in a separate terminal)
streamlit run dashboard.py
complaint-classifier/
├── data.csv # Labeled complaint dataset
├── train.py # Model training script
├── app.py # FastAPI backend
├── dashboard.py # Streamlit frontend
└── requirements.txt
- Expand dataset for improved model accuracy
- Add train/test split with evaluation metrics
- Support for additional complaint categories
- Multi-language complaint support