Update README.md
Browse files
README.md
CHANGED
@@ -15,10 +15,13 @@ npm i @xenova/transformers
|
|
15 |
|
16 |
**Example:** Perform zero-shot audio classification with `Xenova/clap-htsat-unfused`.
|
17 |
```js
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
|
|
|
|
|
|
22 |
// [
|
23 |
// { score: 0.9993992447853088, label: 'dog' },
|
24 |
// { score: 0.0006007603369653225, label: 'vaccum cleaner' }
|
|
|
15 |
|
16 |
**Example:** Perform zero-shot audio classification with `Xenova/clap-htsat-unfused`.
|
17 |
```js
|
18 |
+
import { pipeline } from '@xenova/transformers';
|
19 |
+
|
20 |
+
const classifier = await pipeline('zero-shot-audio-classification', 'Xenova/clap-htsat-unfused');
|
21 |
+
|
22 |
+
const audio = 'https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/dog_barking.wav';
|
23 |
+
const candidate_labels = ['dog', 'vaccum cleaner'];
|
24 |
+
const scores = await classifier(audio, candidate_labels);
|
25 |
// [
|
26 |
// { score: 0.9993992447853088, label: 'dog' },
|
27 |
// { score: 0.0006007603369653225, label: 'vaccum cleaner' }
|