Skip to content

Latest commit

ย 

History

History
162 lines (110 loc) ยท 4.25 KB

File metadata and controls

162 lines (110 loc) ยท 4.25 KB

๐Ÿ”ข DigitVision โ€” Handwritten Digit Recognition Web App

DigitVision is a full-stack deep learning web application that recognizes handwritten digits (0โ€“9) in real time using a Convolutional Neural Network (CNN) trained on the MNIST dataset.

It combines the power of TensorFlow/Keras for digit recognition with a modern Flask + HTML/CSS/JS frontend for an interactive experience.


๐ŸŒ Live Demo

๐Ÿš€ Try it now: https://huggingface.co/spaces/debjani31/DigitVision

(Draw any digit from 0โ€“9 and see real-time predictions!)


๐Ÿ“– Overview

DigitVision demonstrates how deep learning and web development can merge into a powerful AI application.
It uses a CNN model trained with ~99% accuracy on the MNIST dataset and deploys it through Flask, wrapped in a visually engaging user interface.


โœจ Features

โœ… Real-time digit prediction through canvas drawing
โœ… Upload your own digit images for recognition
โœ… Interactive tools (pencil, eraser, clear canvas)
โœ… Confidence score display for predictions
โœ… Clean neon-themed UI with animations
โœ… User Sign-in / Sign-up pages (UI ready for backend integration)


๐Ÿง  Model Details

  • Dataset: MNIST Handwritten Digits
  • Input Shape: 28 ร— 28 ร— 1 grayscale images
  • Architecture:
    • Conv2D (32) โ†’ Conv2D (32) โ†’ MaxPooling2D โ†’ Dropout
    • Conv2D (64) โ†’ Conv2D (64) โ†’ MaxPooling2D โ†’ Dropout
    • Flatten โ†’ Dense(256) โ†’ Dropout โ†’ Dense(10, Softmax)
  • Optimizer: Adam
  • Loss Function: Categorical Crossentropy
  • Accuracy: ~99% (validation)

Model trained on Kaggle and saved as mnist_cnn_model.h5 for deployment.


CNN notebook

๐Ÿงฉ Tech Stack

Layer Technology
Frontend HTML, CSS, JavaScript, Bootstrap
Backend Flask (Python)
Deep Learning TensorFlow, Keras
Image Processing OpenCV, Pillow
Deployment Hugging Face Spaces (Docker + Python)

๐Ÿ–ฅ๏ธ Installation (for local use)

1๏ธโƒฃ Clone the Repository

git clone https://github.com/debjani31/DigitVision.git
cd DigitVision

2๏ธโƒฃ Install Dependencies

pip install -r requirements.txt

3๏ธโƒฃ Run the Flask App

python app.py

Access it at โ†’ http://localhost:5000


๐Ÿงพ How to Use

  1. Launch the app or visit the live Hugging Face demo
  2. Sign in or Sign up (UI available)
  3. Use the canvas to draw a digit or upload one
  4. Click Predict Digit
  5. View predicted number + confidence score instantly ๐ŸŽฏ

๐Ÿ“‚ Project Structure

DigitVision/
โ”‚
โ”œโ”€โ”€ app.py                   # Flask backend & model routes
โ”œโ”€โ”€ mnist_cnn_model.h5       # Trained CNN model
โ”œโ”€โ”€ requirements.txt          # Dependencies
โ”œโ”€โ”€ website/                  # Frontend HTML templates
โ”‚   โ”œโ”€โ”€ layout.html
โ”‚   โ”œโ”€โ”€ home.html
โ”‚   โ”œโ”€โ”€ sign.html
โ”‚   โ””โ”€โ”€ static/ (CSS, JS, images)
โ””โ”€โ”€ README.md

๐Ÿง  Model Pipeline

  1. User draws or uploads a digit

  2. Image is sent to Flask backend

  3. Preprocessed with OpenCV:

    • Grayscale conversion
    • Inversion (white digit on black background)
    • Cropping and centering
    • Resizing to 28ร—28
    • Normalization (0โ€“1)
  4. Model predicts the digit and confidence

  5. Result displayed in the frontend instantly



๐Ÿ”ฎ Future Improvements

  • ๐Ÿงฉ Add Firebase or SQL-based authentication
  • ๐Ÿ“ฑ Make fully responsive for mobile devices
  • ๐Ÿง  Train on EMNIST for letters + digits
  • โ˜๏ธ Auto-deploy with CI/CD (GitHub Actions)

๐Ÿ‘ฉโ€๐Ÿ’ป Author

Debjani Mandal ๐ŸŽ“ Machine Learning & Web Developer Enthusiast ๐ŸŒ Live App on Hugging Face ๐Ÿ’ป Project: DigitVision โ€“ Handwritten Digit Recognition using CNN


๐Ÿช„ License

This project is licensed under the MIT License. Feel free to fork, modify, and build upon it for your own learning or research.