π Update README.md samples for Transformers.js v3 (#1)
Browse files- π Update README.md samples for Transformers.js v3 (19077a6b6c471e73a7207d1f8c6068ca03261fc4)
Co-authored-by: Yuichiro Tachibana <whitphx@users.noreply.huggingface.co>
README.md
CHANGED
@@ -7,18 +7,20 @@ https://huggingface.co/facebook/convnext-tiny-224 with ONNX weights to be compat
|
|
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:** Perform image classification with `Xenova/convnext-tiny-224`.
|
16 |
|
17 |
```js
|
18 |
-
import { pipeline } from '@
|
19 |
|
20 |
// Create image classification pipeline
|
21 |
-
const classifier = await pipeline('image-classification', 'Xenova/convnext-tiny-224'
|
|
|
|
|
22 |
|
23 |
// Classify an image
|
24 |
const url = 'https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/tiger.jpg';
|
|
|
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:** Perform image classification with `Xenova/convnext-tiny-224`.
|
16 |
|
17 |
```js
|
18 |
+
import { pipeline } from '@huggingface/transformers';
|
19 |
|
20 |
// Create image classification pipeline
|
21 |
+
const classifier = await pipeline('image-classification', 'Xenova/convnext-tiny-224', {
|
22 |
+
dtype: "fp32" // Options: "fp32", "fp16", "q8", "q4"
|
23 |
+
});
|
24 |
|
25 |
// Classify an image
|
26 |
const url = 'https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/tiger.jpg';
|