Xenova HF staff commited on
Commit
84f458a
1 Parent(s): b0695e7

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +53 -0
README.md CHANGED
@@ -1,3 +1,56 @@
1
  ---
2
  license: gpl-3.0
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: gpl-3.0
3
+ library_name: transformers.js
4
+ tags:
5
+ - apisr
6
  ---
7
+
8
+ https://github.com/Kiteretsu77/APISR with ONNX weights to be compatible with Transformers.js.
9
+
10
+
11
+ ## Usage (Transformers.js)
12
+
13
+ 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:
14
+ ```bash
15
+ npm i @xenova/transformers
16
+ ```
17
+
18
+ **Example:** Upscale an image with `Xenova/2x_APISR_RRDB_GAN_generator-onnx`.
19
+ ```js
20
+ import { pipeline } from '@xenova/transformers';
21
+
22
+ // Create image-to-image pipeline
23
+ const upscaler = await pipeline('image-to-image', 'Xenova/2x_APISR_RRDB_GAN_generator-onnx', {
24
+ quantized: false,
25
+ });
26
+
27
+ // Upscale an image
28
+ const url = 'https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/anime.png';
29
+ const output = await upscaler(url);
30
+ // RawImage {
31
+ // data: Uint8Array(16588800) [ ... ],
32
+ // width: 1280,
33
+ // height: 960,
34
+ // channels: 3
35
+ // }
36
+
37
+ // (Optional) Save the upscaled image
38
+ output.save('upscaled.png');
39
+ ```
40
+
41
+ <details>
42
+ <summary>See example output</summary>
43
+
44
+ Input image:
45
+
46
+ ![image/png](https://cdn-uploads.huggingface.co/production/uploads/61b253b7ac5ecaae3d1efe0c/w2bnLTYnxxNjX-amzYq6A.png)
47
+
48
+ Output image:
49
+
50
+ ![image/png](https://cdn-uploads.huggingface.co/production/uploads/61b253b7ac5ecaae3d1efe0c/IrTKMGafCinH4QSLq-Cve.png)
51
+
52
+ </details>
53
+
54
+ ---
55
+
56
+ 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`).