Spaces:
Runtime error
Runtime error
Update README.md
Browse files
README.md
CHANGED
|
@@ -11,4 +11,64 @@ license: mit
|
|
| 11 |
short_description: Image_Captioning_Model
|
| 12 |
---
|
| 13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 11 |
short_description: Image_Captioning_Model
|
| 12 |
---
|
| 13 |
|
| 14 |
+
# Image Captioning Model - Hugging Face Deployment
|
| 15 |
+
|
| 16 |
+
This folder contains everything needed to deploy the Image Captioning Model on Hugging Face Spaces.
|
| 17 |
+
|
| 18 |
+
## π¦ Files
|
| 19 |
+
|
| 20 |
+
- `app.py` - Gradio application (rebuilds model architecture and loads weights)
|
| 21 |
+
- `requirements.txt` - Python dependencies
|
| 22 |
+
- `model_weights.h5` - Model weights only (22 MB)
|
| 23 |
+
- `tokenizer_data.json` - Tokenizer vocabulary (JSON format)
|
| 24 |
+
- `model_config.pkl` - Model configuration
|
| 25 |
+
|
| 26 |
+
## π Quick Deploy to Hugging Face Spaces
|
| 27 |
+
|
| 28 |
+
1. Go to [Hugging Face Spaces](https://huggingface.co/spaces)
|
| 29 |
+
2. Click "Create new Space"
|
| 30 |
+
3. Choose:
|
| 31 |
+
- Name: `image-captioning-model` (or your choice)
|
| 32 |
+
- SDK: **Gradio**
|
| 33 |
+
- Visibility: Public or Private
|
| 34 |
+
4. Upload all files from this folder
|
| 35 |
+
5. Wait for build (5-10 minutes)
|
| 36 |
+
6. Done! π
|
| 37 |
+
|
| 38 |
+
## π‘ How It Works
|
| 39 |
+
|
| 40 |
+
This deployment uses a **different approach** than typical model loading:
|
| 41 |
+
|
| 42 |
+
- **Instead of**: Loading the full H5 model (which has compatibility issues)
|
| 43 |
+
- **We do**: Rebuild the model architecture in code and load only the weights
|
| 44 |
+
|
| 45 |
+
This avoids all the Keras version compatibility issues!
|
| 46 |
+
|
| 47 |
+
## π§ Technical Details
|
| 48 |
+
|
| 49 |
+
- **TensorFlow**: 2.10.0
|
| 50 |
+
- **Gradio**: 3.50.2
|
| 51 |
+
- **Model Architecture**: CNN-RNN (InceptionV3 + LSTM)
|
| 52 |
+
- **Weights File**: 22 MB (much smaller than full model)
|
| 53 |
+
- **Tokenizer**: JSON format (no pickle compatibility issues)
|
| 54 |
+
|
| 55 |
+
## β
Advantages of This Approach
|
| 56 |
+
|
| 57 |
+
1. β
No Keras version conflicts
|
| 58 |
+
2. β
Smaller file size (22 MB vs 66 MB)
|
| 59 |
+
3. β
Works with any TensorFlow 2.x version
|
| 60 |
+
4. β
Easy to modify model architecture if needed
|
| 61 |
+
5. β
No pickle security concerns
|
| 62 |
+
|
| 63 |
+
## π Notes
|
| 64 |
+
|
| 65 |
+
- The model architecture is defined in `app.py`
|
| 66 |
+
- Weights are loaded using `model.load_weights()`
|
| 67 |
+
- This is the recommended approach for deploying Keras models
|
| 68 |
+
|
| 69 |
+
---
|
| 70 |
+
|
| 71 |
+
**Created by**: Prabhar Kumar Singh
|
| 72 |
+
**GitHub**: [Prabhat9801/Image_Captioning_Model](https://github.com/Prabhat9801/Image_Captioning_Model)
|
| 73 |
+
|
| 74 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|