This project offers a unified interface to recognize handwritten digits in both:
- 🔢 Western Decimal Digits (0–9)
- 🕉️ Devanagari Digits (०–९)
It consists of three independent Flask APIs—each containerized with its own TensorFlow version—and a unified interface served via Nginx reverse proxy. All services are orchestrated using Docker Swarm and hosted on a single AWS EC2 instance.
🧪 Note: Local development uses Docker Compose, while deployment on EC2 uses Docker Swarm.
- 🧠 Deep learning models using TensorFlow
- 🐳 Each API containerized with isolated environments
- ⚡ Unified Flask API interface for model selection
- 🔁 Nginx reverse proxy to unify routes
- 🔀 Supports both
curland Postman for requests - 🛠️ Orchestrated with Docker Swarm
- ☁️ Production-ready deployment on AWS EC2
UnifiedApi/
├── decimal-api/
├── devanagari-api/
├── unified-api/
├── nginx/
├── docker-compose.yml
├── deployment.yml
└── README.md
git clone https://github.com/Bit-Nest/UnifiedApi.git
cd UnifiedApidocker-compose up --build- Unified UI: http://localhost:5300/
- Decimal API: http://localhost:5100/api/predict
- Devanagari API: http://localhost:5200/api/predict
| Service | Port |
|---|---|
| Unified UI | 5300 |
| Decimal API | 5100 |
| Devanagari API | 5200 |
Endpoint:
POST http://localhost:5300/predict
Form-Data Fields:
| Field | Type | Description |
|---|---|---|
image |
File | Upload a digit image |
model_type |
String | decimal or devanagari |
Example JSON Response:
{
"prediction": "204"
}| API | TensorFlow Version |
|---|---|
| decimal-api | 2.13.0 |
| devanagari-api | 2.19.0 |
| unified-api | N/A (acts as a router) |
ssh -i your-key.pem ubuntu@<EC2_IP>sudo apt update
sudo apt install docker.io docker-compose -y
docker swarm initgit clone https://github.com/Bit-Nest/UnifiedApi.git
cd UnifiedApidocker stack deploy -c deployment.yml unifieddigitapi- Unified UI: http://<EC2_IP>/
- Unified Prediction Endpoint: http://<EC2_IP>/predict
- Decimal API: http://<EC2_IP>/decimal/api/predict
- Devanagari API: http://<EC2_IP>/devanagari/api/predict
Nginx handles internal routing and load balancing between services.
Use Let's Encrypt with Certbot or a Cloudflare proxy to secure your deployment with SSL certificates.
docker-compose builddocker tag decimal-api youruser/decimal-api:latest
docker push youruser/decimal-api:latest# In deployment.yml
image: youruser/decimal-api:latestdocker-compose pull
docker-compose up -dPull requests are welcome! Feel free to contribute to:
- 📈 Improving model accuracy
- 🎨 Enhancing UI/UX
- 🐳 Optimizing Docker & deployment flow