Downloads · 30 days
6
17% of all-time downloads
fatehmujtaba/BLIP-Image-to-recipe
BLIP-Image-to-recipe is a image-to-text model from fatehmujtaba. Use it when you need a caption or text from an image. It is set up for transformers. The card lists the license as apache-2.0.
Downloads · 30 days
6
17% of all-time downloads
All-time downloads
35
Public
Parameters
247M
990 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors990 MB · 100%
From the Hugging Face model README
import requests from PIL import Image
from transformers import BlipForConditionalGeneration, AutoProcessor
img_url = 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSQuFg4LTHUattLGPU0kLzYpBGHRtuqgJY8Gho3uZe_cg&s' image = Image.open(requests.get(img_url, stream=True).raw).convert('RGB')
model = BlipForConditionalGeneration.from_pretrained("Fatehmujtaba/BLIP-Image-to-recipe").to(device) processor = AutoProcessor.from_pretrained("Salesforce/blip-image-captioning-base")
inputs = processor(images=image, return_tensors="pt").to(device) pixel_values = inputs.pixel_values generated_ids = model.generate(pixel_values=pixel_values, max_length=50) generated_caption = processor.batch_decode(generated_ids, skip_special_tokens=True)[0]