Xenova HF staff commited on
Commit
1374aa2
1 Parent(s): 5a62bd1

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +21 -0
README.md CHANGED
@@ -3,5 +3,26 @@ library_name: transformers.js
3
  ---
4
 
5
  https://huggingface.co/dima806/facial_emotions_image_detection 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`).
 
3
  ---
4
 
5
  https://huggingface.co/dima806/facial_emotions_image_detection with ONNX weights to be compatible with Transformers.js.
6
+ ## Usage (Transformers.js)
7
+
8
+ 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:
9
+ ```bash
10
+ npm i @xenova/transformers
11
+ ```
12
+
13
+ **Example:** Perform emotion detection with `Xenova/facial_emotions_image_detection`:
14
+ ```js
15
+ import { pipeline } from '@xenova/transformers';
16
+
17
+ // Create image classification pipeline
18
+ const classifier = await pipeline('image-classification', 'Xenova/facial_emotions_image_detection');
19
+
20
+ // Classify an image
21
+ const url = 'https://i.imgur.com/fhtXyYJ.png';
22
+ const output = await classifier(url);
23
+ // [{ label: 'disgust', score: 0.9915065169334412 }]
24
+ ```
25
+
26
+ ---
27
 
28
  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`).