An AI-powered web application that generates human-like captions from uploaded images using deep learning and computer vision.
The application now supports unlimited sequential image uploads without crashes!
Fixed Issues:
- ✅ "Cannot identify image file" error - Completely eliminated
- ✅ Second upload crashes - Now works perfectly
- ✅ Stale file references - Proper stream management
- ✅ Format switching - JPG/PNG seamlessly supported
What's New:
- Safe image byte handling with BytesIO streams
- Hash-based duplicate detection
- User-friendly error messages
- Proper session state management
For detailed information, see:
FIX_SUMMARY.md- Complete explanation of the fixBUGFIX_VALIDATION.md- Testing guideCHANGELOG.md- Version historyCODE_COMPARISON.md- Before/after code
- 📸 Upload any
.jpg,.jpeg, or.pngimage - 🧠 Deep learning-based caption generation with EfficientNet + LSTM + Attention
- ✨ Beam Search decoding for better results
- 🎨 Modern Streamlit UI with gradients, hover animations, and Lottie animations
- 💬 Clear and interactive output with CTA buttons
- 🔄 [NEW] Support unlimited sequential image uploads without crashes
- 🛡️ [NEW] Safe image handling with robust error recovery
- 🔍 [NEW] Smart upload detection and validation
| Layer | Tools Used |
|---|---|
| Frontend | Streamlit, Lottie, HTML/CSS |
| Backend | Python, TensorFlow, NumPy, Pillow |
| Model | EfficientNetB0 (Encoder), LSTM (Decoder) |
| Dataset | MS COCO captions dataset |
# Clone the repository
git clone https://github.com/AdityaDharawat/Image-Captioning.git
cd Image-Captioning
# Install dependencies
pip install -r requirements.txt
# Run the app
streamlit run app.py🔔 Make sure
image_captioning_model.kerasandtokenizer.pklare present in the root directory.
- Encoder: Pretrained EfficientNetB0
- Decoder: LSTM + Attention mechanism
- Trained on: MS COCO Dataset
- Evaluation: BLEU score, manual inspection
ImageCaptioning/
├── app.py
├── generate_caption.py
├── image_captioning_model.keras
├── tokenizer.pkl
├── assets/
│ └── style.css
│ └── animation.json
├── README.md
This project is open-source and available under the MIT License.
👨💻 Made with 💜 by Aditya Dharawat
