Update code snippet

#1
by Xenova HF staff - opened
Files changed (1) hide show
  1. README.md +4 -4
README.md CHANGED
@@ -18,15 +18,15 @@ npm i @huggingface/transformers
18
  **Example:** Optical Character Recognition (OCR) w/ `onnx-community/mgp-str-base`
19
 
20
  ```js
21
- import { MgpstrForSceneTextRecognition, MgpstrProcessor, RawImage } from '@huggingface/transformers';
22
 
23
  const model_id = 'onnx-community/mgp-str-base';
24
  const model = await MgpstrForSceneTextRecognition.from_pretrained(model_id);
25
  const processor = await MgpstrProcessor.from_pretrained(model_id);
26
 
27
- // Load image from the IIIT-5k dataset
28
- const url = "https://i.postimg.cc/ZKwLg2Gw/367-14.png";
29
- const image = await RawImage.read(url);
30
 
31
  // Preprocess the image
32
  const result = await processor(image);
 
18
  **Example:** Optical Character Recognition (OCR) w/ `onnx-community/mgp-str-base`
19
 
20
  ```js
21
+ import { MgpstrForSceneTextRecognition, MgpstrProcessor, load_image } from '@huggingface/transformers';
22
 
23
  const model_id = 'onnx-community/mgp-str-base';
24
  const model = await MgpstrForSceneTextRecognition.from_pretrained(model_id);
25
  const processor = await MgpstrProcessor.from_pretrained(model_id);
26
 
27
+ // Load image from a URL
28
+ const url = "https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/ocr-demo.png";
29
+ const image = await load_image(url);
30
 
31
  // Preprocess the image
32
  const result = await processor(image);