1 |
|
---|
2 | #---
|
---|
3 | # Setup
|
---|
4 | #---
|
---|
5 |
|
---|
6 | Assuming you have been through setting up:
|
---|
7 |
|
---|
8 | cd ext-cli/
|
---|
9 | ./get-selfcontained-python3.sh
|
---|
10 |
|
---|
11 | Then to setup this extension then all you need to do is:
|
---|
12 |
|
---|
13 | pip install --upgrade google-cloud-vision
|
---|
14 |
|
---|
15 | To enable the Google Vision API, set up a key etc, see:
|
---|
16 |
|
---|
17 | https://cloud.google.com/vision/docs/setup
|
---|
18 |
|
---|
19 |
|
---|
20 | When you create a key, your browsesr downloads a JSON version of the key.
|
---|
21 |
|
---|
22 |
|
---|
23 | Also check:
|
---|
24 |
|
---|
25 | packages/README.txt
|
---|
26 |
|
---|
27 | and
|
---|
28 | src/README.txt
|
---|
29 |
|
---|
30 | and follow the instructions.
|
---|
31 |
|
---|
32 |
|
---|
33 | #---
|
---|
34 | # Using the Extension
|
---|
35 | #---
|
---|
36 |
|
---|
37 | The extension provides the GoogleVisionImagePlugin, for use in collections.
|
---|
38 |
|
---|
39 | Example use of the plugin:
|
---|
40 |
|
---|
41 | <plugin name="GoogleVisionImagePlugin">
|
---|
42 | <option name="-enable_document_ocr"/>
|
---|
43 | <option name="-enable_image_labelling"/>
|
---|
44 | </plugin>
|
---|
45 |
|
---|
46 | The plugin currently has a hard-wired filename for the Google
|
---|
47 | service key. This need's to be in the collection's 'etc'
|
---|
48 | directory as follows:
|
---|
49 |
|
---|
50 | etc/my-google-service-account-key.json
|
---|
51 |
|
---|
52 |
|
---|
53 | For the 'atea-storage' Google Cloud Project, for example, a redacted version of
|
---|
54 | the JSON key file looks like:
|
---|
55 |
|
---|
56 | {
|
---|
57 | "type": "service_account",
|
---|
58 | "project_id": "atea-storage",
|
---|
59 | "private_key_id": "7bc843de4257da515193eaa5b60468fcab5b3948",
|
---|
60 | "private_key": "-----BEGIN PRIVATE KEY-----\n???????.........??????=\n-----END PRIVATE KEY-----\n",
|
---|
61 | "client_email": "service-account@atea-storage.iam.gserviceaccount.com",
|
---|
62 | "client_id": "123???...????",
|
---|
63 | "auth_uri": "https://accounts.google.com/o/oauth2/auth",
|
---|
64 | "token_uri": "https://oauth2.googleapis.com/token",
|
---|
65 | "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
|
---|
66 | "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/service-account%40atea-storage.iam.gserviceaccount.com"
|
---|
67 | }
|
---|
68 |
|
---|
69 |
|
---|