1 | This extension enhances Greenstone3's ability to process with images using
|
---|
2 | the Google Vision API. This includes OCRing of text in documents, OCRing
|
---|
3 | of text in photos, and labelling photos. Presentation of the OCR'd results
|
---|
4 | in enhanced through the Mirador annotation viewer.
|
---|
5 |
|
---|
6 | At build-time, collections can tap into these capabilities using the plugins:
|
---|
7 |
|
---|
8 | GoogleVisionImagePlugin.pm
|
---|
9 | GoogleVisionPagedImagePlugin.pm
|
---|
10 |
|
---|
11 | At runtime
|
---|
12 |
|
---|
13 |
|
---|
14 | #---
|
---|
15 | # Setup
|
---|
16 | #---
|
---|
17 |
|
---|
18 | Run:
|
---|
19 |
|
---|
20 | ./PREPARE-PYTHON3.sh
|
---|
21 |
|
---|
22 | # TLDR
|
---|
23 | cd packages && ./COMPILE-AND-INSTALL.sh && cd ..
|
---|
24 | # See packages/README.txt for more details
|
---|
25 |
|
---|
26 | # TLDR
|
---|
27 | cd src && ./PREPARE.sh && ./COMPILE.sh && ./INSTALL.sh && cd ..
|
---|
28 | # See src/README.txt for more details
|
---|
29 |
|
---|
30 |
|
---|
31 | Review:
|
---|
32 | ant-start-settings.bash.in
|
---|
33 |
|
---|
34 | Copy to:
|
---|
35 | ant-start-settings.bash
|
---|
36 |
|
---|
37 | And edit accordingly. This controls how Greenstone accesses the SimpleAnnotationServer.
|
---|
38 |
|
---|
39 |
|
---|
40 | To enable the Google Vision API, set up a key etc, see:
|
---|
41 |
|
---|
42 | https://cloud.google.com/vision/docs/setup
|
---|
43 |
|
---|
44 |
|
---|
45 | When you create a key, your browsesr downloads a JSON version of the key.
|
---|
46 |
|
---|
47 |
|
---|
48 | #---
|
---|
49 | # Using the Extension: Build-time
|
---|
50 | #---
|
---|
51 |
|
---|
52 | The extension provides the GoogleVisionImagePlugin, for use in collections.
|
---|
53 |
|
---|
54 | Example use of the plugin:
|
---|
55 |
|
---|
56 | <plugin name="GoogleVisionImagePlugin">
|
---|
57 | <option name="-enable_document_ocr"/>
|
---|
58 | <option name="-enable_image_labelling"/>
|
---|
59 | </plugin>
|
---|
60 |
|
---|
61 | The plugin currently has a hard-wired filename for the Google
|
---|
62 | service key. This need's to be in the collection's 'etc'
|
---|
63 | directory as follows:
|
---|
64 |
|
---|
65 | etc/my-google-service-account-key.json
|
---|
66 |
|
---|
67 |
|
---|
68 | For the 'atea-storage' Google Cloud Project, for example, a redacted version of
|
---|
69 | the JSON key file looks like:
|
---|
70 |
|
---|
71 | {
|
---|
72 | "type": "service_account",
|
---|
73 | "project_id": "atea-storage",
|
---|
74 | "private_key_id": "7bc843de4257da515193eaa5b60468fcab5b3948",
|
---|
75 | "private_key": "-----BEGIN PRIVATE KEY-----\n???????.........??????=\n-----END PRIVATE KEY-----\n",
|
---|
76 | "client_email": "[email protected]",
|
---|
77 | "client_id": "123???...????",
|
---|
78 | "auth_uri": "https://accounts.google.com/o/oauth2/auth",
|
---|
79 | "token_uri": "https://oauth2.googleapis.com/token",
|
---|
80 | "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
|
---|
81 | "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/service-account%40atea-storage.iam.gserviceaccount.com"
|
---|
82 | }
|
---|
83 |
|
---|
84 |
|
---|
85 | #---
|
---|
86 | # Using the Extension: Runtime
|
---|
87 | #---
|
---|
88 |
|
---|
89 |
|
---|
90 | Check out the 'intermuse' site and interface
|
---|
91 |
|
---|
92 | Build the intermuse-demo collection
|
---|
93 |
|
---|
94 | Visit the built collection in your browser
|
---|