1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "urls": [
12 "https://upload.wikimedia.org/wikipedia/commons/a/aa/World_War_I_Draft_Registration_Card_for_Louis_Armstrong_1918.gif"
13 ],
14 "fields": [
15 {
16 "name": "full_name",
17 "type": "string"
18 },
19 {
20 "name": "date_of_birth",
21 "type": "date"
22 },
23 {
24 "name": "race",
25 "type": "string"
26 },
27 {
28 "name": "employer",
29 "type": "string"
30 },
31 {
32 "name": "signed",
33 "type": "boolean",
34 "description": "is it signed"
35 }
36 ]
37};
38
39
40const run = await client.actor("helenisapi/form-ocr-to-json-handwritten-printed-forms").call(input);
41
42
43console.log('Results from dataset');
44console.log(`πΎ Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
45const { items } = await client.dataset(run.defaultDatasetId).listItems();
46items.forEach((item) => {
47 console.dir(item);
48});
49
50