Skip to content

Api which takes image as input and returns top 3 predictions for dog breed.

Notifications You must be signed in to change notification settings

bishnuShahi/Dog-breed-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Dog Breed Image Classification API

This is a FastAPI application that provides an API endpoint for classifying dog breeds from uploaded images using a pre-trained FastAI model.

Features

  • Accepts image uploads in PNG, JPG, or JPEG format
  • Validates and processes the uploaded image
  • Returns the top 3 predicted dog breeds and their probabilities

Requirements

  • Python 3.7 or higher
  • FastAI
  • Pillow

Installation

  1. Clone the repository:
git clone https://github.com/your-repo/dog-breed-classifier.git
  1. Install the required packages:
pip install -r requirements.txt

Usage

  1. Start the FastAPI server:
uvicorn api.main:app --reload  # If django project is running, use `uvicorn api.main:app --reload --port 8001`  or any port of your choice
  1. The API will be available at
http://localhost:8000 # Or the port you set
  1. To check if the API is running, send a GET request to the root endpoint:
GET http://localhost:8000/
  1. To classify a dog breed from an image, send a POST request to the /predict endpoint with the image file:
POST http://localhost:8000/predict

Content-Type: multipart/form-data

file: <image_file>

The API will return a JSON response with the top 3 predicted dog breeds and their probabilities:

{
    "prediction": {
        "breed1": 95,
        "breed2": 3,
        "breed3": 2
    }
}

About

Api which takes image as input and returns top 3 predictions for dog breed.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages