This project is a Handwritten Digit Recognition System built using Machine Learning and deployed as an interactive Streamlit web application.
The model is trained using the Scikit-learn Digits Dataset and uses a Support Vector Classifier (SVC) to classify handwritten digits from 0 to 9.
The project also demonstrates fundamental MLOps practices, including:
- Machine Learning model training
- Image preprocessing
- Model serialization
- Streamlit application
- Logging
- Docker containerization
- Git/GitHub version control
- Model evaluation
- Hyperparameter configuration
- โ๏ธ Upload a handwritten digit image
- ๐ผ๏ธ Image preprocessing and normalization
- ๐ข Predict digits from
0to9 - ๐ค SVC-based classification
- ๐ Classification report
- โ๏ธ Hyperparameter configuration
- ๐ Application logging
- ๐ณ Dockerized application
- ๐ Interactive Streamlit UI
- ๐ฆ Saved trained model using Pickle
Support Vector Classifier (SVC)
SVC is a supervised machine learning algorithm that finds an optimal decision boundary between different classes.
For this project, the classifier is trained to recognize:
0 1 2 3 4 5 6 7 8 9
The project uses the built-in:
Scikit-learn Digits Dataset
Dataset characteristics:
- Number of classes:
10 - Image size:
8 ร 8 - Total features:
64 - Pixel values: approximately
0โ16 - Classes: digits
0โ9
Digits Dataset
โ
โผ
Data Preparation
โ
โผ
Train / Test Split
โ
โผ
Feature Processing
โ
โผ
SVC Model Training
โ
โผ
Hyperparameter Tuning
โ
โผ
Model Evaluation
โ
โผ
model.pkl
โ
โผ
Streamlit Application
โ
โผ
Docker Container
For uploaded real-world digit images, the application performs preprocessing before sending the image to the model.
The preprocessing pipeline includes:
Input Image
โ
Grayscale Conversion
โ
Image Inversion
โ
Resize to 8 ร 8
โ
Pixel Normalization
โ
Scale to 0โ16
โ
Flatten to 64 Features
โ
SVC Prediction
This preprocessing is important because the original Scikit-learn Digits Dataset contains small 8 ร 8 images with pixel values in a similar range.
The trained SVC model is evaluated using classification metrics such as:
- Accuracy
- Precision
- Recall
- F1-score
- Support
The generated classification report is available in the public directory.

The SVC model was trained and evaluated using selected hyperparameters.
The hyperparameter results/configuration are available below:
The hyperparameters can be modified and evaluated to find a better-performing model.
| Technology | Purpose |
|---|---|
| Python | Programming language |
| NumPy | Numerical operations |
| Pandas | Data manipulation |
| Scikit-learn | Machine Learning |
| SVC | Classification algorithm |
| Pillow | Image processing |
| Matplotlib | Visualization |
| Streamlit | Web application |
| Pickle | Model serialization |
| Docker | Containerization |
| Git | Version control |
| GitHub | Source code management |
Digits/
โ
โโโ .dockerignore
โโโ .gitignore
โโโ Dockerfile
โโโ README.md
โโโ requirements.txt
โ
โโโ main.py
โโโ config.py
โโโ model.pkl
โ
โโโ core/
โ โโโ __init__.py
โ โโโ digits.py
โ โโโ logger.py
โ
โโโ public/
โ โโโ classification_report.png
โ โโโ hyperparameters.png
โ
โโโ logs/
โโโ app.log
git clone <YOUR_GITHUB_REPOSITORY_URL>Move into the project directory:
cd Digitspython3 -m venv venvActivate the environment on Linux/macOS:
source venv/bin/activateFor Windows:
venv\Scripts\activatepip install -r requirements.txtstreamlit run main.pyThe application will be available at:
http://localhost:8501
This project is containerized using Docker.
docker build -t digits-app .docker run -p 8501:8501 digits-appThen open:
http://localhost:8501
Dockerfile
โ
โผ
Docker Image
โ
โผ
Docker Container
โ
โผ
Streamlit Application
โ
โผ
Port 8501
The application includes logging functionality for tracking application events.
Logs can contain information such as:
- Model loading
- Image preprocessing
- Prediction status
- Prediction result
- Errors and exceptions
Example:
2026-09-15 16:00:00 - INFO - Digits model loaded
2026-09-15 16:00:05 - INFO - Starting image preprocessing
2026-09-15 16:00:05 - INFO - Image preprocessing completed
2026-09-15 16:00:06 - INFO - Prediction result: 7
Application logs are stored in:
logs/app.log
The project can be extended into a complete production-oriented MLOps pipeline.
Planned improvements include:
- GitHub Actions CI/CD
- Automated unit testing
- MLflow experiment tracking
- DVC for dataset/model versioning
- Model Registry
- Automated Docker image publishing
- Cloud deployment
- Model monitoring
- Data drift detection
- Model performance monitoring
- Automated model retraining
Machine Learning
โ
โผ
Model Serialization
โ
โผ
Streamlit Application
โ
โผ
Logging
โ
โผ
Docker
โ
โผ
Git / GitHub
โ
โผ
CI/CD โโโโโโโโโโโโโโโโโ
โ โ
โผ โผ
MLflow DVC
โ โ
โโโโโโโโฌโโโโโโโโ
โผ
Model Registry
โ
โผ
Deployment
โ
โผ
Monitoring
โ
โผ
Retraining
Machine Learning Engineer
๐ง Email: hasiraza511@gmail.com
- Machine Learning
- Deep Learning
- Computer Vision
- MLOps
- Model Deployment
- Python
- Data Science
If you find this project useful, feel free to โญ star the repository and explore the code.
This project is created for educational and portfolio purposes.
