Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions functions/ocr/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ const translate = new Translate();

// [END functions_ocr_setup]

// [START functions_ocr_publish]
/**
* Publishes the result to the given pubsub topic and returns a Promise.
*
Expand All @@ -45,7 +44,6 @@ const publishResult = async (topicName, data) => {
const [topic] = await pubsub.topic(topicName).get({autoCreate: true});
topic.publish(dataBuffer);
};
// [END functions_ocr_publish]

// [START functions_ocr_detect]
/**
Expand Down Expand Up @@ -83,14 +81,16 @@ const detectText = async (bucketName, filename) => {
lang: lang,
};

// Helper function that publishes translation result to a Pub/Sub topic
// For more information on publishing Pub/Sub messages, see this page:
// https://cloud.google.com/pubsub/docs/publisher
return publishResult(topicName, messageData);
});

return Promise.all(tasks);
};
// [END functions_ocr_detect]

// [START functions_ocr_rename]
/**
* Appends a .txt suffix to the image name.
*
Expand All @@ -101,7 +101,6 @@ const detectText = async (bucketName, filename) => {
const renameImageForSave = (filename, lang) => {
return `${filename}_to_${lang}.txt`;
};
// [END functions_ocr_rename]

// [START functions_ocr_process]
/**
Expand Down