Skip to content

MaryemHadjWannes/ai-image-captioning

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

12 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“· AI Image Captioning App

A simple Streamlit app that uses the BLIP/BLIP2 models to generate captions for any uploaded image.

πŸš€ How It Works

  1. Upload an image (jpg/png)
  2. The AI model will analyze it
  3. You’ll get a descriptive caption like:

    β€œA cat wearing sunglasses while sitting on a couch.”

🧠 Tech Stack

  • Python
  • Streamlit
  • Transformers (BLIP model from Salesforce)
  • Hugging Face

πŸ› οΈ Run Locally

pip install streamlit transformers torch torchvision Pillow
streamlit run ai_image_captioning_app.py

🧠 Model Comparison: BLIP Base vs Large vs BLIP2

We tested the same image using 3 different models. Here's how their descriptions differ:

πŸƒ Input Image:

image1


βš™οΈ Using BLIP Base Model

model = BlipForConditionalGeneration.from_pretrained("Salesforce/blip-image-captioning-base")

Screenshot from 2025-03-29 14-53-07

πŸ”₯ Using BLIP Large Model

model = BlipForConditionalGeneration.from_pretrained("Salesforce/blip-image-captioning-large")

Screenshot from 2025-03-29 14-51-22

🧠 Using BLIP2 + Flan-T5 Model

processor = Blip2Processor.from_pretrained("Salesforce/blip2-flan-t5-xl")
model = Blip2ForConditionalGeneration.from_pretrained("Salesforce/blip2-flan-t5-xl")

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages