Prabhat9801's picture
Update README.md
5439e29 verified

A newer version of the Gradio SDK is available: 6.2.0

Upgrade
metadata
title: Image Captioning Model
emoji: πŸ’»
colorFrom: pink
colorTo: purple
sdk: gradio
sdk_version: 6.0.2
app_file: app.py
pinned: false
license: mit
short_description: Image_Captioning_Model

Image Captioning Model - Hugging Face Deployment

This folder contains everything needed to deploy the Image Captioning Model on Hugging Face Spaces.

πŸ“¦ Files

  • app.py - Gradio application (rebuilds model architecture and loads weights)
  • requirements.txt - Python dependencies
  • model_weights.h5 - Model weights only (22 MB)
  • tokenizer_data.json - Tokenizer vocabulary (JSON format)
  • model_config.pkl - Model configuration

πŸš€ Quick Deploy to Hugging Face Spaces

  1. Go to Hugging Face Spaces
  2. Click "Create new Space"
  3. Choose:
    • Name: image-captioning-model (or your choice)
    • SDK: Gradio
    • Visibility: Public or Private
  4. Upload all files from this folder
  5. Wait for build (5-10 minutes)
  6. Done! πŸŽ‰

πŸ’‘ How It Works

This deployment uses a different approach than typical model loading:

  • Instead of: Loading the full H5 model (which has compatibility issues)
  • We do: Rebuild the model architecture in code and load only the weights

This avoids all the Keras version compatibility issues!

πŸ”§ Technical Details

  • TensorFlow: 2.10.0
  • Gradio: 3.50.2
  • Model Architecture: CNN-RNN (InceptionV3 + LSTM)
  • Weights File: 22 MB (much smaller than full model)
  • Tokenizer: JSON format (no pickle compatibility issues)

βœ… Advantages of This Approach

  1. βœ… No Keras version conflicts
  2. βœ… Smaller file size (22 MB vs 66 MB)
  3. βœ… Works with any TensorFlow 2.x version
  4. βœ… Easy to modify model architecture if needed
  5. βœ… No pickle security concerns

πŸ“ Notes

  • The model architecture is defined in app.py
  • Weights are loaded using model.load_weights()
  • This is the recommended approach for deploying Keras models

Created by: Prabhar Kumar Singh GitHub: Prabhat9801/Image_Captioning_Model

Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference