Skip to content

thawro/flowers-102-classification

Repository files navigation

title sdk emoji colorFrom colorTo
flowers-classification
docker
🌍
gray
green

About

Image classification model trained using PyTorch Lightning framework and shared on Hugging Face with the use of gradio and Docker.

Tech stack

Commands

Three possible ways to go with this repository, all require to start from the repository root path.

Model training

After the model training, two files are saved in "model" directory, transform.pt - torch transform used to transform input image, model.pt - torch model used to predict flower species.

  1. Go to backend service
cd services/backend
  1. Install dependencies with poetry
poetry install
  1. Create virtual environment with poetry
poetry shell
  1. Run python script to train the model
python src/train.py

Gradio demo app

  1. Build docker image and run container with gradio app:
docker build -t flowers .
docker run -it -p 7860:7860 --name flowers_app flowers

FastAPI backend with ReactJS frontend

  1. Run backend and frontend services with docker-compose
docker-compose up --build
  1. Open http://0.0.0.0:5000/docs in your browser to see possible FastAPI endpoints
  2. Open http://0.0.0.0:3000 in your browser to see ReactJS frontend