Created
June 17, 2018 17:13
-
-
Save glenbray/b5e9eb2aa1a76c0c6864b56012e0c2dd to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import Amplify, { API } from "aws-amplify"; | |
import awsExports from "./aws-exports"; | |
Amplify.configure({ | |
...awsExports, | |
API: { | |
endpoints: [ | |
{ | |
name: "rekognition", | |
endpoint: "https://rekognition.ap-southeast-2.amazonaws.com", | |
service: "rekognition", | |
region: "ap-southeast-2" | |
} | |
] | |
} | |
}); | |
async function detectText(bytes) { | |
const apiName = "rekognition"; | |
const path = "/detect-text"; | |
const body = { Image: { Bytes: bytes } }; | |
const headers = { | |
"X-Amz-Target": "RekognitionService.DetectText", | |
"Content-Type": "application/x-amz-json-1.1" | |
}; | |
const init = { | |
body: body, | |
headers: headers | |
}; | |
return await API.post(apiName, path, init); | |
} | |
export { detectText }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment