Downloads · 30 days
15
15% of all-time downloads
samim2024/clip
clip is a zero-shot image classification model from samim2024. Use it for the zero-shot image classification task on the model card, and read the license before you ship it in a product. It is set up for transformers.
Downloads · 30 days
15
15% of all-time downloads
All-time downloads
98
Public
Parameters
151M
605 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors605 MB · 99%
From the Hugging Face model README
Top predictions:
Saree: 64.89%
Dupatta: 25.81%
Lehenga: 7.51%
Leggings and Salwar: 0.84% Women Kurta: 0.44%

from PIL import Image
import requests
from transformers import CLIPProcessor, CLIPModel
model = CLIPModel.from_pretrained("samim2024/clip")
processor = CLIPProcessor.from_pretrained("samim2024/clip")
url = "https://www.istockphoto.com/photo/indian-saris-gm93355119-10451468"
image = Image.open(requests.get(url, stream=True).raw)
inputs = processor(text=["a photo of a saree", "a photo of a blouse"], images=image, return_tensors="pt", padding=True)
outputs = model(**inputs)
logits_per_image = outputs.logits_per_image # this is the image-text similarity score
probs = logits_per_image.softmax(dim=1) # we can take the softmax to get the label probabilities