Image Classification Web Application with FastAPI and Gradio
This project demonstrates a complete pipeline for a image classification system using Convolutional Neural Networks (CNNs), FastAPI, Gradio, and Docker. The project includes user authentication, image upload, classification, and history retrieval, with a focus on continuous integration and deployment.
This project provides a comprehensive example of how to build a machine learning application with a REST API for model inference and a user-friendly interface for interacting with the model. It includes user authentication, image upload functionality, and a history of past classifications.
- CNN Model: Image classification using a Convolutional Neural Network built with PyTorch.
- FastAPI: High-performance API backend.
- Gradio: User-friendly interface for image upload and classification. (TODO)
- PostgreSQL: Relational database for storing user data and classification history.
- User Authentication: Secure JWT-based authentication.
- CI/CD: Continuous integration and deployment using GitHub Actions.
- Docker: Containerized deployment for easy setup and scaling.
- Python
- PyTorch
- FastAPI
- Gradio
- SQLAlchemy
- PostgreSQL
- JWT
- Docker
- GitHub Actions
- Poetry
- Docker
- Docker Compose
- Poetry
- Python 3.10+
git clone https://github.com/username/repository.git
cd repository
poetry install
Create a .env
file in the root directory. See env_example.txt for more details.
docker-compose up --build
The FastAPI application will be available at http://localhost:8000
.
- Register:
POST /api/v1/auth/register
- Login:
POST /api/v1/auth/login
- Logout:
POST /api/v1/auth/logout
- Classify Image:
POST /api/v1/ml/predict
- Get User Info:
GET /api/v1/users/me
- Get History:
GET /api/v1/users/me/history
FastAPI provides interactive API documentation (Swagger) at http://localhost:8000/docs
and http://localhost:8000/redoc
.
The project includes a GitHub Actions workflow for continuous integration and deployment and defined in .github/workflows
.
This project is licensed under the MIT License. See the LICENSE file for more information.