Skip to content

Repository files navigation

Dog Breed Classifier — Flask App

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.

Setup

# 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.py

Open http://localhost:5000

Project Structure

dog_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

How It Works

  1. train_model.py pivots 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 to model.pkl.

  2. app.py loads the bundle at startup. The /predict endpoint takes form data, re-encodes it using the saved encoders, and returns probabilities for all groups and the top 5 breeds as JSON.

  3. The frontend renders animated probability bars and a confidence summary without any page reload.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages