source: gs3-extensions/structured-image/trunk/README.txt@ 36920

Last change on this file since 36920 was 36920, checked in by davidb, 17 months ago

Updated details

File size: 2.6 KB
Line 
1
2#---
3# Setup
4#---
5
6Assuming you have been through setting up:
7
8 cd ext-cli/
9 ./get-selfcontained-python3.sh
10
11Then to setup this extension then all you need to do is:
12
13 pip install --upgrade google-cloud-vision
14
15To enable the Google Vision API, set up a key etc, see:
16
17 https://cloud.google.com/vision/docs/setup
18
19
20When you create a key, your browsesr downloads a JSON version of the key.
21
22
23#---
24# Using the Extension
25#---
26
27The extension provides the GoogleVisionImagePlugin, for use in collections.
28
29
30Small workaround needed if checked out in the GS3 extension area:
31
32 export GSDL3EXTS=$GSDL3EXTS:structured-image
33
34
35Example use of the plugin:
36
37 <plugin name="GoogleVisionImagePlugin">
38 <option name="-enable_document_ocr"/>
39 <option name="-enable_image_labelling"/>
40 </plugin>
41
42The plugin currently has a hard-wired filename for the Google
43service key. This need's to be in the collection's 'etc'
44directory as follows:
45
46 etc/my-google-service-account-key.json
47
48
49For the 'atea-storage' Google Cloud Project, for example, a redacted version of
50the JSON key file looks like:
51
52{
53 "type": "service_account",
54 "project_id": "atea-storage",
55 "private_key_id": "7bc843de4257da515193eaa5b60468fcab5b3948",
56 "private_key": "-----BEGIN PRIVATE KEY-----\n???????.........??????=\n-----END PRIVATE KEY-----\n",
57 "client_email": "[email protected]",
58 "client_id": "123???...????",
59 "auth_uri": "https://accounts.google.com/o/oauth2/auth",
60 "token_uri": "https://oauth2.googleapis.com/token",
61 "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
62 "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/service-account%40atea-storage.iam.gserviceaccount.com"
63}
64
65
66
67=========
68
69Deprecated
70
71#====
72# Getting the extension
73#====
74
75Assuming you are in the Greenstone3 top-level (i.e. GSDL3SRCHOME) directory,
76(if not already done so) this extension can be checked out as follows:
77
78 svn co https://svn.greenstone.org/gs3-extensions/structured-image/trunk ext/structured-image
79
80Note that the plugin this extension introduces makes use of a Google Service Account and requires credentials. For more details, visit: https://cloud.google.com/vision/docs/setup.
81
82
83#====
84# Compiling the extension
85#====
86
87#-<>
88# <One-time-only>
89#--
90
91cd ext/structured-image
92./CREATE-VENV-PYTHON3.sh
93cd ../..
94
95ln -s ext/structured-image/SETUP-TOP-LEVEL.sh SETUP.sh
96ln -s ext/structured-image/DEVEL-TOP-LEVEL.sh DEVEL.sh
97
98# If your python does not already have Google Cloud Vision
99source ./SETUP.sh
100pip install --upgrade google-cloud-vision
101
102#--
103# </One-time-only>
104#</>
Note: See TracBrowser for help on using the repository browser.