DigReco (short for Digits Recognition) is an AI-powered application designed to recognize handwritten digits. It uses TensorFlow for model development and Flask for deployment, the project provides a simple, interactive interface to predict digits written by users.
This project was presented in a webinar. Here you can find the recorded video for complete walkthrough of project - Link.
- AI Model: Built with a Convolutional Neural Network (CNN) using TensorFlow/Keras.
- Interactive UI: Allows users to upload an image for recognition.
- Real-Time Prediction: Instant feedback on digit recognition.
- Scalable Backend: Flask powers the server for easy deployment and API integration.
- Customizability: Ready for extensions to support additional datasets or recognition tasks.
- Backend: Flask (Python)
- AI Framework: TensorFlow/Keras
- Frontend: HTML/CSS/JavaScript
- Deployment: Flask Server
DigReco/
│
├───FrontEnd/ # Contains all frontend-related files
│ │
│ ├── index.html # Main HTML file that provides the user interface
│ ├── scripts.js # JavaScript for handling user interactions and API calls
│ └── styles.css # CSS file for styling the UI
│
├───ModelServing/ # Folder for model deployment and serving
│ │
│ ├── backend.py # Flask-based backend to handle API requests and serve predictions
│ └── tuned_handwritten_digit_model.h5 # Pre-trained model for handwritten digit recognition
│
├───ModelTraining/ # Folder for training the model
│ │
│ └── training.py # Script for training the digit recognition model using TensorFlow/Keras
│
└───TestingData/ # Sample testing images for validating the model
│
├── 0.PNG
├── 2.PNG
├── 3.PNG
├── 5-2.PNG
├── 6.PNG
├── 7.PNG
└── 8.PNG
- Python 3.8 or higher
- TensorFlow/Keras
- Flask
-
Clone the repository:
git clone https://github.com/prady00/digreco.git cd digreco
-
Create a virtual environment (optional but recommended):
python3 -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Training the model (optional, I've added a pretrained model):
cd ModelTraining python training.py
It will produce a model tuned_handwritten_digit_model.h5 You can move tuned_handwritten_digit_model.h5 to ModelServing folder for deployment or serving
-
Start the backend:
cd ModelServing python backend.py
Keep the terminal running. It exposes the model through Flask on port 5000
-
Start the frontend:
cd Frontend python -m http.server
-
Access the frontend app: Open http://localhost:8000 in your browser.
- The model is a Convolutional Neural Network (CNN) trained on the MNIST dataset.
- Architecture:
- Input Layer: 28x28 grayscale image
- 2 Convolutional Layers + MaxPooling
- Flatten Layer
- Fully Connected Dense Layers
- Activation: ReLU, Softmax
- Output: Predicted digit (0-9) with confidence score.
- Upload digit on the provided UI and click "Predict".
- Alternatively, upload a
.png
or.jpg
file containing a handwritten digit.
Use the Flask API to send images programmatically.
Endpoint:
POST /predict
Request:
Send an image as form data under the key file
.
Example using cURL:
curl -X POST -F "[email protected]" http://localhost:5000/predict
Response:
{
"digit": 5,
"confidence": 0.97
}
- Support for multi-digit recognition.
- Integration with other digit datasets (e.g., EMNIST).
- Deploy to cloud platforms like AWS, Azure, or Heroku.
- Mobile-friendly UI for seamless usage.
We welcome contributions! Feel free to:
- Fork the repository.
- Create a new feature branch.
- Submit a pull request with improvements or fixes.
This project is licensed under the MIT License.
For queries or suggestions, reach out at:
- Email: [email protected]
- LinkedIn: [Pradeep Kumar on Linkedin] (https://www.linkedin.com/in/prady00/)