A newer version of the Gradio SDK is available: 6.22.0
title: MNIST Digit Recognizer
emoji: π’
colorFrom: blue
colorTo: purple
sdk: gradio
app_file: app.py
pinned: false
MNIST Digit Recognizer π’
A deep learning model that recognizes handwritten digits (0-9) built from scratch using PyTorch and deployed with Gradio on HuggingFace Spaces. ce
π Live Demo
π Project Overview
This project is part of my 6-month AI Engineer roadmap (Phase 4 β Deep Learning). The model is a Multi Layer Perceptron (MLP) trained on the MNIST dataset of 70,000 handwritten digit images.
π§ What I Built
- Built a neural network from scratch using PyTorch
- Trained on 60,000 images, tested on 10,000 images
- Achieved ~97% test accuracy
- Deployed live using Gradio on HuggingFace Spaces
ποΈ Model Architecture
Input β 784 neurons (28Γ28 flattened) Hidden Layer 1 β 128 neurons + ReLU Hidden Layer 2 β 64 neurons + ReLU Output Layer β 10 neurons (digits 0-9) Loss Function β CrossEntropyLoss Optimizer β Adam (lr=0.001) Epochs β 5
π Dataset
- Name: MNIST
- Training images: 60,000
- Test images: 10,000
- Image size: 28Γ28 grayscale
- Classes: 10 (digits 0 to 9)
π οΈ Tech Stack
- Python
- PyTorch
- Gradio
- HuggingFace Spaces
- Pillow
π Project Structure
app.py β Gradio UI and prediction logic train.py β Model training and saving model.pkl β Trained model weights requirements.txt β Dependencies
π‘ Concepts Used
- Multi Layer Perceptron (MLP)
- Forward Propagation
- Backpropagation
- ReLU Activation Function
- CrossEntropy Loss
- Adam Optimizer
- Gradient Descent