Skip to content

Instantly share code, notes, and snippets.

@glenbray
Created June 17, 2018 17:13
Show Gist options
  • Save glenbray/b5e9eb2aa1a76c0c6864b56012e0c2dd to your computer and use it in GitHub Desktop.
Save glenbray/b5e9eb2aa1a76c0c6864b56012e0c2dd to your computer and use it in GitHub Desktop.
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