A simple scikit-learn + FastAPI + MongoDB + Docker project that classifies support tickets by intent.
Built as a learning project for ML + backend integration.
Tip
For more comprehensive steps, go to Setup
cd support-ticket-classifier && docker compose up --build- FastAPI API with
/predictendpoint - Uses a scikit-learn model
- Provides script to generate synthetic data
- Provides script to train model locally
- Logs predictions to MongoDB (for potential retraining)
- Dockerized for easy startup
Before running the project, make sure you have:
- Docker
- Optional: mongosh installed locally if you want to inspect the db.
- Clone the repo:
git clone https://github.com/kajoban/support-ticket-classifier.git
cd support-ticket-classifier- Build and start services
docker compose up --buildThis will spin up
- MongoDB (container: mongo)
- FastAPI server (container: support-ticket-classifier-api)
The API will be available at http://127.0.0.1:8000.
Tip
The API docs will be available at http://127.0.0.1:8000/docs
- Make predictions using
/predictendpoint.
Example cURL:
curl -X POST "http://127.0.0.1:8000/predict" \
-H "Content-Type: application/json" \
-d '{"text": "I canβt log into my account"}'Possible response:
{
"intent": "login_issue",
"certainty": 0.87
}Where certainty is a float between 0 and 1 representing the model's confidence in the predicted intent.
- Inspecting stored predictions
Predictions are stored to mongodb:
mongosh mongodb://localhost:27017
use support_ticket_classifier
db.predictions.find().pretty()