Update README.md
Browse files
README.md
CHANGED
@@ -11,6 +11,18 @@ If you haven't already, you can install the [Transformers.js](https://huggingfac
|
|
11 |
npm i @xenova/transformers
|
12 |
```
|
13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
**Example:** Perform zero-shot image classification with `CLIPModel`.
|
15 |
|
16 |
```js
|
|
|
11 |
npm i @xenova/transformers
|
12 |
```
|
13 |
|
14 |
+
**Example:** Perform zero-shot image classification with the `pipeline` API.
|
15 |
+
```js
|
16 |
+
const classifier = await pipeline('zero-shot-image-classification', 'Xenova/clip-vit-base-patch16');
|
17 |
+
const url = 'https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/tiger.jpg';
|
18 |
+
const output = await classifier(url, ['tiger', 'horse', 'dog']);
|
19 |
+
// [
|
20 |
+
// { score: 0.9993917942047119, label: 'tiger' },
|
21 |
+
// { score: 0.0003519294841680676, label: 'horse' },
|
22 |
+
// { score: 0.0002562698791734874, label: 'dog' }
|
23 |
+
// ]
|
24 |
+
```
|
25 |
+
|
26 |
**Example:** Perform zero-shot image classification with `CLIPModel`.
|
27 |
|
28 |
```js
|