https://github.com/ahnaf19/anime-or-not
Anime-Or-Not (AoN) is an API that exposes prediction endpoint of an deep learning leveraged image classifier, detecting its anime or cartoon.
https://github.com/ahnaf19/anime-or-not
docker fastapi python pytorch
Last synced: 3 months ago
JSON representation
Anime-Or-Not (AoN) is an API that exposes prediction endpoint of an deep learning leveraged image classifier, detecting its anime or cartoon.
- Host: GitHub
- URL: https://github.com/ahnaf19/anime-or-not
- Owner: Ahnaf19
- License: mit
- Created: 2025-02-07T17:16:39.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-08T07:11:28.000Z (over 1 year ago)
- Last Synced: 2025-04-06T21:16:55.319Z (about 1 year ago)
- Topics: docker, fastapi, python, pytorch
- Language: Jupyter Notebook
- Homepage:
- Size: 87.9 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Anime-Or-Not
Anime-Or-Not (AoN) is an API that exposes prediction endpoint of an deep learning leveraged image classifier, detecting if its either anime or cartoon.
## Project Overview
Although Anime and Cartoon both are a form of animation and look almost the same, there are some structural differences between the two that can be exploited to classify them.
**Created an image classification API that leverages a deep learning model to classify images as either anime or cartoon. The API exposes a prediction endpoint to take an image as input and return a classification label with prediction probability.**
checkout the kaggle notebook here
> Developed on: python 3.10.16
     
## Docker Build & Run
To build and run the application using Docker, follow these steps:
### Prerequisites
Ensure you have Docker installed on your machine. You can download it from [here](https://www.docker.com/products/docker-desktop).
#### Build Docker Image
> [!IMPORTANT]
> `Docker Daemon` or `Docker Desktop` must be running while building Docker Image.
Navigate to the root directory of the repo where the `Dockerfile` is located and run the following command to build the Docker image:
```sh
docker build -t aon:latest .
```
#### Run Docker Container
After building the Docker image, you can run it using the following command:
```sh
docker run -dp 8000:8000 aon:latest
```
or give the container a name:
```sh
docker run -dp 8000:8000 --name aon-latest aon:latest
```
This will start the application in a Docker container. The application can be accessed at `http://localhost:8000` e.g. `127.0.0.1:8000`
> [!NOTE]
> `-dp` (`-d` & `-p`) tag runs the container in detached mode (in the background, terminal is available to use right away) and container port `8000` is mapped to local port `8000`.
Go to `http://localhost:8000/docs` and try the end points. `/model/predict` takes in an image and returns prediction.
#### Stopping the Container
To stop the running container, first find the container ID using:
```sh
docker ps
```
Then stop the container using:
```sh
docker stop
```
## Run locally with Uvicorn
- [optional but recommended] create a venv and activate it
- Install dependencies:
```sh
pip install -r requirements.txt
```
- start Uvicorn server:
```sh
uvicorn app.main:app --reload
```
- `cntrl+c` to break the server.
## Milestones
- [x] develop ML prediction pipeline ๐ค
- [x] Expose the prediction pipeline with api end points ๐
- [ ] unit testing ๐งช
- [ ] write comprehensive readme ๐โจ
- [ ] write readme-dev ๐
- [x] dockerize the repo ๐ณ
- [x] Code Auto-formatting & Linting with Pre-commit (check-yaml, end-of-file-fixer, trailing-whitespace, black, isort, mypy) ๐จ
- [ ] add GitHub Action for format checks โ
- [ ] Study deploy requirement and deploy! ๐