A web app that classifies a dog's breed group (and top matching breeds) from 10 physical/lifestyle traits using a Random Forest model trained on the UK Kennel Club dataset.
# 1. Install dependencies
pip install -r requirements.txt
# 2. Put Dog_Breeds.csv in this folder, then train the model
python train_model.py
# 3. Start the app
python app.pydog_app/
├── app.py # Flask routes + prediction logic
├── train_model.py # Trains & saves model.pkl
├── requirements.txt
├── Dog_Breeds.csv # ← add this
├── model.pkl # ← generated by train_model.py
└── templates/
└── index.html # UI
-
train_model.pypivots the long-format CSV into a feature matrix, encodes all 10 traits, and trains two Random Forest classifiers — one for breed group (7 classes) and one for exact breed (222 classes). Both are saved tomodel.pkl. -
app.pyloads the bundle at startup. The/predictendpoint takes form data, re-encodes it using the saved encoders, and returns probabilities for all groups and the top 5 breeds as JSON. -
The frontend renders animated probability bars and a confidence summary without any page reload.