Image-to-Text
Transformers
Safetensors
PyTorch
blip
image-text-to-text
image-captioning
vision-language-model
multimodal-ai
computer-vision
deep-learning
Instructions to use YaekobB/blip-caption-model with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use YaekobB/blip-caption-model with Transformers:
# Use a pipeline as a high-level helper # Warning: Pipeline type "image-to-text" is no longer supported in transformers v5. # You must load the model directly (see below) or downgrade to v4.x with: # 'pip install "transformers<5.0.0' from transformers import pipeline pipe = pipeline("image-to-text", model="YaekobB/blip-caption-model")# Load model directly from transformers import AutoProcessor, AutoModelForImageTextToText processor = AutoProcessor.from_pretrained("YaekobB/blip-caption-model") model = AutoModelForImageTextToText.from_pretrained("YaekobB/blip-caption-model") - Notebooks
- Google Colab
- Kaggle
Add model card documentation
Browse files
README.md
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
tags:
|
| 4 |
+
- image-captioning
|
| 5 |
+
- blip
|
| 6 |
+
- vision-language-model
|
| 7 |
+
- multimodal-ai
|
| 8 |
+
- computer-vision
|
| 9 |
+
- deep-learning
|
| 10 |
+
- transformers
|
| 11 |
+
- pytorch
|
| 12 |
+
pipeline_tag: image-to-text
|
| 13 |
+
library_name: transformers
|
| 14 |
+
---
|
| 15 |
+
|
| 16 |
+
# BLIP Caption Model
|
| 17 |
+
|
| 18 |
+
This repository contains a BLIP-based image captioning model used to generate natural-language captions from uploaded images.
|
| 19 |
+
|
| 20 |
+
The model is connected to a live Hugging Face Space demo:
|
| 21 |
+
|
| 22 |
+
👉 [Multimodal Image Captioning with BLIP Demo](https://huggingface.co/spaces/YaekobB/image-captioning-blip-demo)
|
| 23 |
+
|
| 24 |
+
## Model Description
|
| 25 |
+
|
| 26 |
+
This model is designed for automatic image captioning. Given an input image, it generates a short textual description of the visual content.
|
| 27 |
+
|
| 28 |
+
The project demonstrates the use of vision-language models for multimodal AI applications, combining computer vision and natural language generation.
|
| 29 |
+
|
| 30 |
+
## Intended Use
|
| 31 |
+
|
| 32 |
+
This model can be used for:
|
| 33 |
+
|
| 34 |
+
- Image caption generation
|
| 35 |
+
- Vision-language AI demonstrations
|
| 36 |
+
- Multimodal learning experiments
|
| 37 |
+
- Educational and portfolio projects
|
| 38 |
+
- Prototyping image-to-text applications
|
| 39 |
+
|
| 40 |
+
## How to Use
|
| 41 |
+
|
| 42 |
+
```python
|
| 43 |
+
from transformers import BlipProcessor, BlipForConditionalGeneration
|
| 44 |
+
from PIL import Image
|
| 45 |
+
import torch
|
| 46 |
+
|
| 47 |
+
model_id = "YaekobB/blip-caption-model"
|
| 48 |
+
|
| 49 |
+
processor = BlipProcessor.from_pretrained(model_id)
|
| 50 |
+
model = BlipForConditionalGeneration.from_pretrained(model_id)
|
| 51 |
+
|
| 52 |
+
image = Image.open("your_image.jpg").convert("RGB")
|
| 53 |
+
|
| 54 |
+
inputs = processor(image, return_tensors="pt")
|
| 55 |
+
|
| 56 |
+
with torch.no_grad():
|
| 57 |
+
output = model.generate(**inputs, max_new_tokens=50)
|
| 58 |
+
|
| 59 |
+
caption = processor.decode(output[0], skip_special_tokens=True)
|
| 60 |
+
print(caption)
|
| 61 |
+
```
|
| 62 |
+
|
| 63 |
+
## Live Demo
|
| 64 |
+
|
| 65 |
+
A live inference demo is available on Hugging Face Spaces:
|
| 66 |
+
|
| 67 |
+
[https://huggingface.co/spaces/YaekobB/image-captioning-blip-demo](https://huggingface.co/spaces/YaekobB/image-captioning-blip-demo)
|
| 68 |
+
|
| 69 |
+
The demo allows users to upload one or more images and generate captions using the model.
|
| 70 |
+
|
| 71 |
+
## Limitations
|
| 72 |
+
|
| 73 |
+
This model may generate inaccurate or incomplete captions, especially for:
|
| 74 |
+
|
| 75 |
+
- Complex scenes with many objects or people
|
| 76 |
+
- Small or unclear objects
|
| 77 |
+
- Low-quality or blurry images
|
| 78 |
+
- Culturally specific contexts
|
| 79 |
+
- Images requiring detailed reasoning or domain expertise
|
| 80 |
+
|
| 81 |
+
Generated captions should be treated as model-generated descriptions, not guaranteed factual annotations.
|
| 82 |
+
|
| 83 |
+
## Ethical Considerations
|
| 84 |
+
|
| 85 |
+
This model should not be used as the sole source of truth for safety-critical, medical, legal, or identity-sensitive decisions.
|
| 86 |
+
|
| 87 |
+
It may produce biased, incomplete, or incorrect descriptions depending on the input image and training data limitations.
|
| 88 |
+
|
| 89 |
+
## Author
|
| 90 |
+
|
| 91 |
+
**Yaekob Beyene Yowhanns**
|
| 92 |
+
M.Sc. Artificial Intelligence and Computer Science
|
| 93 |
+
University of Calabria
|
| 94 |
+
|
| 95 |
+
GitHub: [yaekobB](https://github.com/yaekobB)
|
| 96 |
+
Hugging Face: [YaekobB](https://huggingface.co/YaekobB)
|