Ahmad Tawil

Python · Shipped

GenAI Image Captioning

AI-powered image captioning app using Hugging Face BLIP and Gradio.

Python

This project demonstrates an AI-powered image captioning application built with Hugging Face Transformers and Gradio.
It uses the BLIP (Bootstrapping Language-Image Pretraining) model to generate natural language captions for uploaded images.


✨ Features #

  • Upload any image and generate descriptive captions automatically.
  • Powered by the Salesforce BLIP image captioning model.
  • Clean and interactive Gradio web interface.
  • Optional text prompt support for guided captioning.
  • Extensible for batch processing (media, SEO, accessibility).

📂 Project Structure #

image-captioning/
├── image_captioning.py     # Gradio app
├── image_cap.py            # Simple CLI version
├── requirements.txt        # Dependencies
├── captions.txt            # Example output (URL: caption pairs)
└── README.md               # Project documentation

⚙️ Installation #

  1. Clone the repository:
git clone https://github.com/<your-username>/image-captioning-ai.git
cd image-captioning-ai
  1. Create a virtual environment (recommended):
python -m venv .venv
source .venv/bin/activate     # On Windows: .venv\Scripts\activate
  1. Install dependencies:
pip install -r requirements.txt

🚀 Usage #

Run the Gradio app #

python image_captioning.py
  • A local URL will appear (e.g. http://127.0.0.1:7860).
  • Open it in your browser.
  • Upload an image → AI generates a caption.

Example #

Input:
IBM HQ

Output:

"a large glass building with trees in front of it"

📊 Business Use Case #

This application can be adapted for news and media agencies:

  • Automates image captioning for hundreds of daily articles.
  • Saves editorial time while ensuring consistency.
  • Provides alt-text for accessibility.
  • Improves SEO performance by supplying meaningful image descriptions.

☁️ Deployment #

You can deploy this app to the cloud:

  • IBM Code Engine – containerized deployment with a free Kubernetes cluster.
  • Hugging Face Spaces – quick demo hosting with Gradio support.
  • Docker – containerize locally and push to your preferred registry.

🛠️ Tech Stack #


📌 Next Steps #

  • Add batch captioning (folder → captions.csv).
  • Support for captions via webpage URL (scrape and caption).
  • Export captions directly into CMS for media/news workflows.
  • Integrate speech-to-text (STT) or text-to-speech (TTS) for accessibility.

👤 Author #

  • Developed as part of IBM Generative AI learning modules.
  • Author: Ahmad Tawil
  • Guided project by Sina Nazeri, IBM Developer Skills Network

© IBM Corporation. All rights reserved.