ocr

package module
v0.0.0-...-edee6f1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 24, 2025 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package ocr contains Go samples for creating OCR (Optical Character Recognition) Cloud functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ProcessImage

func ProcessImage(ctx context.Context, cloudevent event.Event) error

ProcessImage is executed when a file is uploaded to the Cloud Storage bucket you created for uploading images. It runs detectText, which processes the image for text.

func SaveResult

func SaveResult(ctx context.Context, cloudevent event.Event) error

SaveResult is executed when a message is published to the Cloud Pub/Sub topic specified by the RESULT_TOPIC environment vairable, and saves the data packet to a file in GCS.

func TranslateText

func TranslateText(ctx context.Context, cloudevent event.Event) error

TranslateText is executed when a message is published to the Cloud Pub/Sub topic specified by the TRANSLATE_TOPIC environment variable, and translates the text using the Google Translate API.

Types

type MessagePublishedData

type MessagePublishedData struct {
	Message PubSubMessage
}

Eventarc sends a MessagePublishedData object. See the documentation for additional fields and more details: https://cloud.google.com/eventarc/docs/cloudevents#pubsub_1

type PubSubMessage

type PubSubMessage struct {
	Data []byte `json:"data"`
}

PubSubMessage is the payload of a Pub/Sub event. See the documentation for additional fields and more details: https://cloud.google.com/pubsub/docs/reference/rest/v1/PubsubMessage

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL