Update README.md
Browse files
README.md
CHANGED
@@ -7,22 +7,22 @@ https://huggingface.co/superb/hubert-base-superb-ks with ONNX weights to be comp
|
|
7 |
|
8 |
## Usage (Transformers.js)
|
9 |
|
10 |
-
If you haven't already, you can install the [Transformers.js](https://huggingface.co/docs/transformers.js) JavaScript library from [NPM](https://www.npmjs.com/package/@
|
11 |
```bash
|
12 |
-
npm i @
|
13 |
```
|
14 |
|
15 |
**Example:** Speech command recognition w/ `Xenova/hubert-base-superb-ks`.
|
16 |
|
17 |
```javascript
|
18 |
-
import { pipeline } from '@
|
19 |
|
20 |
// Create audio classification pipeline
|
21 |
const classifier = await pipeline('audio-classification', 'Xenova/hubert-base-superb-ks');
|
22 |
|
23 |
// Classify audio
|
24 |
const url = 'https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/speech-commands_down.wav';
|
25 |
-
const output = await classifier(url, {
|
26 |
// [
|
27 |
// { label: 'down', score: 0.9954305291175842 },
|
28 |
// { label: 'go', score: 0.004518700763583183 },
|
|
|
7 |
|
8 |
## Usage (Transformers.js)
|
9 |
|
10 |
+
If you haven't already, you can install the [Transformers.js](https://huggingface.co/docs/transformers.js) JavaScript library from [NPM](https://www.npmjs.com/package/@huggingface/transformers) using:
|
11 |
```bash
|
12 |
+
npm i @huggingface/transformers
|
13 |
```
|
14 |
|
15 |
**Example:** Speech command recognition w/ `Xenova/hubert-base-superb-ks`.
|
16 |
|
17 |
```javascript
|
18 |
+
import { pipeline } from '@huggingface/transformers';
|
19 |
|
20 |
// Create audio classification pipeline
|
21 |
const classifier = await pipeline('audio-classification', 'Xenova/hubert-base-superb-ks');
|
22 |
|
23 |
// Classify audio
|
24 |
const url = 'https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/speech-commands_down.wav';
|
25 |
+
const output = await classifier(url, { top_k: 5 });
|
26 |
// [
|
27 |
// { label: 'down', score: 0.9954305291175842 },
|
28 |
// { label: 'go', score: 0.004518700763583183 },
|