https://github.com/codewithcharan/mnist-digits-recognition
https://github.com/codewithcharan/mnist-digits-recognition
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/codewithcharan/mnist-digits-recognition
- Owner: CodeWithCharan
- Created: 2025-03-08T14:38:48.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-10T13:55:56.000Z (about 1 year ago)
- Last Synced: 2025-03-18T16:57:10.981Z (about 1 year ago)
- Language: Jupyter Notebook
- Size: 321 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# MNIST Digits Recognition
This project focuses on recognizing handwritten digits using a deep learning model trained on the MNIST dataset. The model is deployed as a REST API using FastAPI, packaged into a Docker container and orchestrated using Kubernetes for scalable deployment. The API allows users to upload digit images and receive predictions in real time.
🐳 **Docker Image:** `docker pull codewithcharan/mnist_api:v1`
🤗 **Trained Model:** [Hugging Face](https://huggingface.co/CodeWithCharan/MNIST-Model)
## **Demo Video**
https://github.com/user-attachments/assets/e8a1d444-68f8-42bb-b999-14933032cbb7
## Cloning the Repository
To clone the repository, use the following command:
```bash
git clone https://github.com/CodeWithCharan/MNIST-digits-recognition.git
```
## Running the Training Script
To train the model, run:
```bash
python train.py
```
## Running the Inference Script
To test the model with an image, run:
```bash
python inference.py --image test_digit.png
```
## Running the Application with Docker
To build and run the application using Docker:
### Build the Docker Image
```bash
docker build -t /mnist_api:v1 .
```
### Run the Docker Container
```bash
docker run -p 8000:8000 /mnist_api:v1
```
## Deploying with Kubernetes
### Apply Deployment and Service Configurations
```bash
kubectl apply -f deployment.yaml
kubectl apply -f service.yaml
```
### Check the Running Pods
```bash
kubectl get pods
```
### Expose the Service
```bash
minikube service mnist-api-service
```
Once exposed, you can test the API using Postman or `curl`:
```bash
curl -X POST http://127.0.0.1:/predict -F "file=@test_digit.png"
```