Fix error in example code snippet
#3
by
marksverdhei
- opened
README.md
CHANGED
|
@@ -26,6 +26,7 @@ Here is how to use this model to perform zero-shot image classification:
|
|
| 26 |
|
| 27 |
```python
|
| 28 |
from transformers import pipeline
|
|
|
|
| 29 |
|
| 30 |
# load pipeline
|
| 31 |
ckpt = "google/siglip2-base-patch16-naflex"
|
|
@@ -33,6 +34,7 @@ image_classifier = pipeline(model=ckpt, task="zero-shot-image-classification")
|
|
| 33 |
|
| 34 |
# load image and candidate labels
|
| 35 |
url = "http://images.cocodataset.org/val2017/000000039769.jpg"
|
|
|
|
| 36 |
candidate_labels = ["2 cats", "a plane", "a remote"]
|
| 37 |
|
| 38 |
# run inference
|
|
|
|
| 26 |
|
| 27 |
```python
|
| 28 |
from transformers import pipeline
|
| 29 |
+
from transformers.image_utils import load_image
|
| 30 |
|
| 31 |
# load pipeline
|
| 32 |
ckpt = "google/siglip2-base-patch16-naflex"
|
|
|
|
| 34 |
|
| 35 |
# load image and candidate labels
|
| 36 |
url = "http://images.cocodataset.org/val2017/000000039769.jpg"
|
| 37 |
+
image = load_image(url)
|
| 38 |
candidate_labels = ["2 cats", "a plane", "a remote"]
|
| 39 |
|
| 40 |
# run inference
|