Created
December 19, 2018 14:30
-
-
Save HassenIO/34df3f3865be071f27f7a56248529eec to your computer and use it in GitHub Desktop.
Pre-processing script for AWS SageMaker Ground Truth
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const ocrResults = require("./ocr-results.json"); | |
const dataLocation = "<Data location in S3 bucket>"; | |
exports.handler = async (event) => { | |
console.info(event); | |
const fileName = event.dataObject['source-ref'].substr(dataLocation.length); | |
const extracts = ocrResults[fileName] || {rekognition: "__error.rekognition__", gcVision: "__error.gcVision__"}; | |
console.info(extracts); | |
const categories = [extracts["rekognition"], extracts["gcVision"], "Neither"]; | |
const response = { | |
taskInput: { | |
taskObject: fileName, | |
categories | |
} | |
}; | |
console.info(response); | |
return response; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment