Xenova HF staff commited on
Commit
beb8641
1 Parent(s): 55feb86

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +23 -0
README.md CHANGED
@@ -4,4 +4,27 @@ library_name: transformers.js
4
 
5
  https://huggingface.co/facebook/convnextv2-tiny-22k-224 with ONNX weights to be compatible with Transformers.js.
6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  Note: Having a separate repo for ONNX weights is intended to be a temporary solution until WebML gains more traction. If you would like to make your models web-ready, we recommend converting to ONNX using [🤗 Optimum](https://huggingface.co/docs/optimum/index) and structuring your repo like this one (with ONNX weights located in a subfolder named `onnx`).
 
4
 
5
  https://huggingface.co/facebook/convnextv2-tiny-22k-224 with ONNX weights to be compatible with Transformers.js.
6
 
7
+ ## Usage (Transformers.js)
8
+
9
+ 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/@xenova/transformers) using:
10
+ ```bash
11
+ npm i @xenova/transformers
12
+ ```
13
+
14
+ **Example:** Perform object-detection with `Xenova/convnextv2-tiny-22k-224`.
15
+
16
+ ```js
17
+ import { pipeline } from '@xenova/transformers';
18
+
19
+ // Create image classification pipeline
20
+ const classifier = await pipeline('image-classification', 'Xenova/convnextv2-tiny-22k-224');
21
+
22
+ // Classify an image
23
+ const url = 'https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/tiger.jpg';
24
+ const output = await classifier(url);
25
+ console.log(output)
26
+ ```
27
+
28
+ ---
29
+
30
  Note: Having a separate repo for ONNX weights is intended to be a temporary solution until WebML gains more traction. If you would like to make your models web-ready, we recommend converting to ONNX using [🤗 Optimum](https://huggingface.co/docs/optimum/index) and structuring your repo like this one (with ONNX weights located in a subfolder named `onnx`).