Name:
interface
Value:
Amplify has re-imagined the way frontend developers build fullstack applications. Develop and deploy without the hassle.

Page updated May 2, 2024

Label objects in an image

Note: Make sure to complete the getting started section first, where you will set up the IAM roles with the right policy actions

Working with the API

Detect labels, such if an image has a desk or a chair in it

import { Predictions } from '@aws-amplify/predictions';
Predictions.identify({
labels: {
source: {
file
},
type: 'LABELS'
}
})
.then((response) => {
const { labels } = response;
labels.forEach((object) => {
const { name, boundingBoxes } = object;
});
})
.catch((err) => console.log({ err }));

Detect unsafe content in an image

import { Predictions } from '@aws-amplify/predictions';
const { unsafe } = await Predictions.identify({
labels: {
source: {
file
},
type: 'UNSAFE'
}
})

For both labels and unsafe content

import { Predictions } from '@aws-amplify/predictions';
const { labels, unsafe } = await Predictions.identify({
labels: {
source: {
file
},
type: 'ALL'
}
})