Label objects in an image
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' }})