1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "imageUrls": [
12 "https://raw.githubusercontent.com/naptha/tesseract.js/master/tests/assets/images/testocr.png",
13 "https://raw.githubusercontent.com/naptha/tesseract.js/master/tests/assets/images/bill.png",
14 "https://raw.githubusercontent.com/naptha/tesseract.js/master/tests/assets/images/cosmic.png",
15 "https://raw.githubusercontent.com/naptha/tesseract.js/master/tests/assets/images/escape_chars.png",
16 "https://raw.githubusercontent.com/naptha/tesseract.js/master/tests/assets/images/simple.jpg",
17 "https://raw.githubusercontent.com/naptha/tesseract.js/master/tests/assets/images/simple.webp",
18 "https://raw.githubusercontent.com/naptha/tesseract.js/master/tests/assets/images/simple.gif",
19 "https://raw.githubusercontent.com/naptha/tesseract.js/master/tests/assets/images/simple-90.jpg",
20 "https://raw.githubusercontent.com/tesseract-ocr/test/main/testing/phototest.tif",
21 "https://raw.githubusercontent.com/tesseract-ocr/test/main/testing/eurotext.tif",
22 "https://raw.githubusercontent.com/tesseract-ocr/test/main/testing/8071_093.3B.tif"
23 ],
24 "languages": [
25 "eng"
26 ],
27 "maxTextBytesPerRow": 3000,
28 "includeLines": false
29};
30
31
32const run = await client.actor("appdata-labs/image-to-text-ocr").call(input);
33
34
35console.log('Results from dataset');
36console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
37const { items } = await client.dataset(run.defaultDatasetId).listItems();
38items.forEach((item) => {
39 console.dir(item);
40});
41
42