https://github.com/lahsivjar/gcloud-ocr
Sample OCR code to use with GCS and Cloud Functions
https://github.com/lahsivjar/gcloud-ocr
cloud-functions gcloud gcs golang-examples iap pubsub
Last synced: 8 months ago
JSON representation
Sample OCR code to use with GCS and Cloud Functions
- Host: GitHub
- URL: https://github.com/lahsivjar/gcloud-ocr
- Owner: lahsivjar
- Created: 2019-07-16T08:08:55.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-08-01T17:41:09.000Z (almost 7 years ago)
- Last Synced: 2025-02-05T10:49:57.423Z (over 1 year ago)
- Topics: cloud-functions, gcloud, gcs, golang-examples, iap, pubsub
- Language: Go
- Size: 33.2 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# OCR using GCS and Cloud Functions
Sample code to use google functions with vision API and google cloud storage. The result is dumped into elasticsearch which is running on K8s cluster exposed via IAP.
## Pipeline

## Pre setup
- Create pub/sub topic with name `image-file-type`
- Create pub/sub topic with name `pdf-file-type`
- Create pub/sub topic with name `es-upload`
- Copy env.yaml.sample to env.yaml and update required values
```
WARNING: The env.yaml file has service account credentials which should be stored as a secret but it is out of scope for this PoC to do so. To learn more about it see [this](https://cloud.google.com/solutions/secrets-management/).
```
## Deployment
```
gcloud functions deploy DispatchWithFileType \
--runtime go111 \
--trigger-resource \
--trigger-event google.storage.object.finalize
```
```
gcloud functions deploy DetectTextsFromImage \
--runtime go111 \
--trigger-topic image-file-types
```
```
gcloud functions deploy UploadTextsToES \
--runtime go111 \
--trigger-topic es-upload \
--env-vars-file env.yaml
```