Downloads · 30 days
0
ryaaa/waawwaaw
waawwaaw is a machine learning model from ryaaa. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as cc-by-nc-4.0.
Downloads · 30 days
0
Access
Public
Updated Jul 4, 2024
Repo size
—
Likes
0
Public
Click a slice to open those files.
Other1.5 KB · 67%
From the Hugging Face model README
from PIL import Image import requests
from transformers import CLIPProcessor, CLIPModel
model = CLIPModel.from_pretrained("geolocal/StreetCLIP") processor = CLIPProcessor.from_pretrained("geolocal/StreetCLIP")
url = "https://huggingface.co/geolocal/StreetCLIP/resolve/main/sanfrancisco.jpeg" image = Image.open(requests.get(url, stream=True).raw)
choices = ["San Jose", "San Diego", "Los Angeles", "Las Vegas", "San Francisco"] inputs = processor(text=choices, 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