Image-to-Text
Transformers
Safetensors
English
blip
image-text-to-text
image-captioning
vision-language
Instructions to use muhammedaydiiinnn/blip-flickr8k-caption with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use muhammedaydiiinnn/blip-flickr8k-caption 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="muhammedaydiiinnn/blip-flickr8k-caption")# Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("muhammedaydiiinnn/blip-flickr8k-caption") model = AutoModelForMultimodalLM.from_pretrained("muhammedaydiiinnn/blip-flickr8k-caption") - Notebooks
- Google Colab
- Kaggle
BLIP Flickr8k Caption Model
Fine-tuned BLIP image captioning model trained on Flickr8k.
Base model
Salesforce/blip-image-captioning-base
Usage
from transformers import BlipProcessor, BlipForConditionalGeneration
from PIL import Image
import torch
model_id = "muhammedaydiiinnn/blip-flickr8k-caption"
processor = BlipProcessor.from_pretrained(model_id)
model = BlipForConditionalGeneration.from_pretrained(model_id)
image = Image.open("test.jpg").convert("RGB")
inputs = processor(images=image, return_tensors="pt")
with torch.inference_mode():
output = model.generate(**inputs, max_new_tokens=30)
caption = processor.decode(output[0], skip_special_tokens=True)
print(caption)
- Downloads last month
- 2