Instructions to use kakaobrain/align-base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use kakaobrain/align-base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("zero-shot-image-classification", model="kakaobrain/align-base") pipe( "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/parrots.png", candidate_labels=["animals", "humans", "landscape"], )# Load model directly from transformers import AutoProcessor, AutoModelForZeroShotImageClassification processor = AutoProcessor.from_pretrained("kakaobrain/align-base") model = AutoModelForZeroShotImageClassification.from_pretrained("kakaobrain/align-base") - Notebooks
- Google Colab
- Kaggle
Commit ·
11204f7
1
Parent(s): d332311
Update README.md (#1)
Browse files- Update README.md (71fdc45ba2a9d48167b9cfe5823d7c60c33b1d1f)
Co-authored-by: Alara Dirik <adirik@users.noreply.huggingface.co>
README.md
CHANGED
|
@@ -33,7 +33,7 @@ model = AlignModel.from_pretrained("kakaobrain/align-base")
|
|
| 33 |
url = "http://images.cocodataset.org/val2017/000000039769.jpg"
|
| 34 |
image = Image.open(requests.get(url, stream=True).raw)
|
| 35 |
|
| 36 |
-
inputs = processor(text=["a photo of a cat", "a photo of a dog"], images=image, return_tensors="pt"
|
| 37 |
|
| 38 |
outputs = model(**inputs)
|
| 39 |
logits_per_image = outputs.logits_per_image # this is the image-text similarity score
|
|
|
|
| 33 |
url = "http://images.cocodataset.org/val2017/000000039769.jpg"
|
| 34 |
image = Image.open(requests.get(url, stream=True).raw)
|
| 35 |
|
| 36 |
+
inputs = processor(text=["a photo of a cat", "a photo of a dog"], images=image, return_tensors="pt")
|
| 37 |
|
| 38 |
outputs = model(**inputs)
|
| 39 |
logits_per_image = outputs.logits_per_image # this is the image-text similarity score
|