Xenova HF staff commited on
Commit
74cc4c9
1 Parent(s): 8e3a142

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +35 -0
README.md CHANGED
@@ -8,4 +8,39 @@ pipeline_tag: image-to-text
8
 
9
  https://huggingface.co/facebook/nougat-small with ONNX weights to be compatible with Transformers.js.
10
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  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`).
 
8
 
9
  https://huggingface.co/facebook/nougat-small with ONNX weights to be compatible with Transformers.js.
10
 
11
+ ---
12
+ library_name: transformers.js
13
+ tags:
14
+ - transformers
15
+ ---
16
+
17
+ ## Usage (Transformers.js)
18
+
19
+ 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:
20
+ ```bash
21
+ npm i @xenova/transformers
22
+ ```
23
+
24
+ You can then use the model to convert images of scientific PDFs into markdown like this:
25
+
26
+ ```js
27
+ import { pipeline } from '@xenova/transformers';
28
+
29
+ // Create an image-to-text pipeline
30
+ const pipe = await pipeline('image-to-text', 'Xenova/nougat-small');
31
+
32
+ // Generate markdown
33
+ const url = 'https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/nougat_paper.png';
34
+ const output = await pipe(url, {
35
+ min_length: 1,
36
+ max_new_tokens: 40,
37
+ bad_words_ids: [[pipe.tokenizer.unk_token_id]],
38
+ });
39
+ console.log(output);
40
+ // [{ generated_text: "# Nougat: Neural Optical Understanding for Academic Documents\n\nLukas Blecher\n\nCorrespondence to: [email protected]\n\nGuillem Cucur" }]
41
+ ```
42
+
43
+
44
+ ---
45
+
46
  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`).