Xenova HF staff commited on
Commit
596e5cf
·
verified ·
1 Parent(s): 8f76ef6

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +31 -0
README.md CHANGED
@@ -1,7 +1,38 @@
1
  ---
2
  library_name: transformers.js
 
 
3
  ---
4
 
5
  https://huggingface.co/timm/fastvit_ma36.apple_in1k 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`).
 
1
  ---
2
  library_name: transformers.js
3
+ pipeline_tag: image-classification
4
+ license: other
5
  ---
6
 
7
  https://huggingface.co/timm/fastvit_ma36.apple_in1k with ONNX weights to be compatible with Transformers.js.
8
 
9
+ ## Usage (Transformers.js)
10
+
11
+ 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:
12
+ ```bash
13
+ npm i @xenova/transformers
14
+ ```
15
+
16
+ **Example:** Perform image classification with `Xenova/fastvit_ma36.apple_in1k`.
17
+ ```js
18
+ import { pipeline } from '@xenova/transformers';
19
+
20
+ // Create an image classification pipeline
21
+ const classifier = await pipeline('image-classification', 'Xenova/fastvit_ma36.apple_in1k');
22
+
23
+ // Classify an image
24
+ const url = 'https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/tiger.jpg';
25
+ const output = await classifier(url, { topk: 5 });
26
+ console.log(output);
27
+ // [
28
+ // { label: 'tiger, Panthera tigris', score: 0.546970784664154 },
29
+ // { label: 'tiger cat', score: 0.16752418875694275 },
30
+ // { label: 'lynx, catamount', score: 0.0018565849168226123 },
31
+ // { label: 'jaguar, panther, Panthera onca, Felis onca', score: 0.0017013729084283113 },
32
+ // { label: 'dhole, Cuon alpinus', score: 0.000908317684661597 }
33
+ // ]
34
+ ```
35
+
36
+ ---
37
+
38
  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`).