An AI-powered image classification app using Python, TensorFlow & Flask — upload any image and get instant predictions with a clean, modern web UI.
- 📤 Upload Image - Choose any image from your device (JPEG, PNG, or WebP)
- 🧠 AI Processing - The MobileNetV2 model analyzes the image in real-time
- 📊 Get Results - Receive top-5 predictions with confidence percentages
- ✨ Instant Display - View beautiful, formatted results in your browser
┌────────────────────────────────────────────────────────────┐
│ AI IMAGE CLASSIFIER - APPLICATION FLOW │
├────────────────────────────────────────────────────────────┤
│ │
│ STEP 1: UPLOAD INTERFACE │
│ ┌──────────────────────────────────────────────────────┐ │
│ │ 📁 Drop image here or click to browse │ │
│ │ Accepts: JPEG, PNG, WebP (max 25MB) │ │
│ └──────────────────────────────────────────────────────┘ │
│ ↓ │
│ STEP 2: AI PROCESSING │
│ ┌──────────────────────────────────────────────────────┐ │
│ │ 🧠 TensorFlow + MobileNetV2 Model │ │
│ │ • Pre-trained on ImageNet (1,000 classes) │ │
│ │ • Lightweight & Fast (25ms inference) │ │
│ │ • Accurate predictions with confidence scores │ │
│ └──────────────────────────────────────────────────────┘ │
│ ↓ │
│ STEP 3: DETAILED RESULTS │
│ ┌──────────────────────────────────────────────────────┐ │
│ │ Top-5 Predictions: │ │
│ │ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ │ │
│ │ 1. Dog [████████████████] 98.34% │ │
│ │ 2. Puppy [██████] 1.45% │ │
│ │ 3. Animal [███] 0.15% │ │
│ │ 4. Mammal [██] 0.04% │ │
│ │ 5. Canine [█] 0.02% │ │
│ │ Processing time: 0.23 seconds │ │
│ └──────────────────────────────────────────────────────┘ │
│ │
└────────────────────────────────────────────────────────────┘
- 🖼️ Universal Image Support - Works with JPEG, PNG, and WebP formats
- ⚡ Lightning Fast - MobileNetV2 optimized for speed and accuracy
- 📊 Confidence Scores - Top-5 predictions with detailed percentages
- 🎨 Beautiful UI - Clean, responsive, modern web interface
- 🔌 REST API - Programmatic access via HTTP endpoints
- 🐳 Docker Ready - Containerized deployment for easy scaling
- 📱 Mobile Friendly - Works seamlessly on all devices
- 🔒 Secure - Local processing, no data sent to external servers
| Component | Technology |
|---|---|
| ML Framework | TensorFlow / Keras |
| Backend | Python, Flask |
| Frontend | HTML, CSS, JavaScript |
| Pre-trained Model | MobileNetV2 (ImageNet) |
| Server | Gunicorn |
| Containerization | Docker |
| Model Size | ~13 MB |
ai-image-classifier/
├── app.py # Flask application entry point
├── requirements.txt # Python dependencies
├── Dockerfile # Docker configuration
├── docker-compose.yml # Docker compose setup
├── static/
│ ├── css/
│ │ └── style.css # Application styling
│ └── js/
│ └── script.js # Frontend logic
├── templates/
│ ├── base.html # Base template
│ ├── index.html # Upload page
│ └── results.html # Results display
├── models/
│ └── mobilenetv2.h5 # Pre-trained model
└── utils/
├── predictor.py # Prediction logic
└── image_handler.py # Image processing
# Clone the repository
git clone https://github.com/razinahmed/ai-image-classifier.git
cd ai-image-classifier
# Create virtual environment (recommended)
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Run the application
python app.py
# Open in browser
# Navigate to http://localhost:5000# Build the Docker image
docker build -t ai-image-classifier .
# Run the container
docker run -p 5000:5000 ai-image-classifier
# Access the application
# Navigate to http://localhost:5000# Start the application
docker-compose up -d
# View logs
docker-compose logs -f
# Stop the application
docker-compose down| Endpoint | Method | Description |
|---|---|---|
/predict |
POST |
Classify an uploaded image |
/ |
GET |
Serve the web interface |
/health |
GET |
Check API health status |
curl -X POST -F "image=@photo.jpg" http://localhost:5000/predict{
"success": true,
"predictions": [
{
"class": "dog",
"confidence": 0.9834
},
{
"class": "puppy",
"confidence": 0.0145
}
],
"processing_time": 0.23
}{
"success": false,
"error": "No image provided",
"status_code": 400
}MobileNetV2 is a lightweight convolutional neural network architecture designed by Google for mobile and embedded vision applications.
| Property | Details |
|---|---|
| Parameters | 3.5M |
| Model Size | ~13 MB |
| Input Shape | 224 × 224 × 3 |
| Training Data | ImageNet-1k |
| Classes | 1,000 object classes |
| Accuracy (Top-1) | ~71.8% |
| Inference Speed | ~25ms (CPU) |
| Architecture | Inverted Residuals with Linear Bottlenecks |
✅ Lightweight - Perfect for real-time inference
✅ Fast - Minimal latency on CPU-only hardware
✅ Accurate - Solid ImageNet performance
✅ Portable - Easy deployment on any platform
✅ Proven - Battle-tested across millions of devices
tensorflow>=2.10.0
flask>=2.2.0
keras>=2.10.0
pillow>=9.0.0
numpy>=1.22.0
python-dotenv>=0.20.0
gunicorn>=20.1.0
For complete requirements, see requirements.txt
Contributions are welcome and greatly appreciated! Here's how you can help:
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
- 🎨 UI/UX improvements
- 📈 Model accuracy enhancements
- 📚 Documentation improvements
- 🧪 Test coverage expansion
- 🐛 Bug fixes and optimizations
This project is licensed under the MIT License - see the LICENSE file for details.
MIT License summary:
- ✅ Commercial use
- ✅ Modification
- ✅ Distribution
- ✅ Private use
⚠️ Liability limitation⚠️ Warranty disclaimer
- GitHub Issues: Report bugs or request features
- Author: Abdul Rasak V
- Email: Contact via GitHub profile
⭐ If you found this project helpful, please consider giving it a star!
