A Flask application that uses OCR + CNN to recognize handwritten digits and math operators from an image, reconstruct the expression, and safely evaluate it (no insecure eval()).
➡️ The app predicts 2+3*4 and computes the result: = 14.
- 🖼️ Image preprocessing with OpenCV
- 🔤 CNN model (Keras/TensorFlow) for digit/operator recognition
- 🧮 Safe arithmetic evaluator (no arbitrary code execution)
- 🌐 Flask API endpoint
/predictfor uploads - ✅ Unit tests and GitHub Actions CI
- Docker installed on your system
-
Clone the repository
git clone https://github.com/iot-lab-kiit/handwritten-math-solver.git cd handwritten-math-solver -
Add model files
Place your trained model files in themodel/folder:model/model.jsonmodel/model_weights.h5
-
Build the Docker image
docker build -t handwritten-math-solver . -
Run the container
docker run -p 5000:5000 handwritten-math-solver
-
Access the app
Visit http://localhost:5000
git clone https://github.com/iot-lab-kiit/handwritten-math-solver.git
cd handwritten-math-solver
python -m venv venv
source venv/bin/activate # or venv\Scripts\activate on Windows
pip install -r requirements.txtPlace your trained model files in the model/ folder:
model/model.jsonmodel/model_weights.h5
python app.pyVisit http://127.0.0.1:5000.
We welcome contributions!
Check issues labeled “good first issue” or “help wanted” if you’re new.
Ways to help:
- Improve preprocessing or recognition
- Add more operators or equation solving
- Write more tests
- Improve docs or CI/CD pipeline
See contributing.md for details.
- Python 3.9+
- Flask
- TensorFlow / Keras
- OpenCV
- NumPy / Pillow
- Pytest
- GitHub Actions
MIT License — see LICENSE