Detects faces on publicly-accessible image URL
npm i @superfaceai/one-sdk
const { SuperfaceClient } = require('@superfaceai/one-sdk');
// You can manage tokens here: https://superface.ai/insights
const sdk = new SuperfaceClient({ sdkAuthToken: '<< Login to get your token >>' });
async function run() {
// Load the profile
const profile = await sdk.getProfile('computer-vision/face-detection@1.0.2');
// Use the profile
const result = await profile
.getUseCase('FaceDetection')
.perform({
imageUrl: 'https://upload.wikimedia.org/wikipedia/commons/c/c3/RH_Louise_Lillian_Gish.jpg'
}, {
provider: 'mock'
});
// Handle the result
try {
const data = result.unwrap();
console.log(data);
} catch (error) {
console.error(error);
}
}
run();
{
"imageUrl": "https://upload.wikimedia.org/wikipedia/commons/c/c3/RH_Louise_Lillian_Gish.jpg"
}
[
{
"faces": [
{
"emotions": {
"anger": "veryUnlikely",
"happiness": "veryUnlikely",
"sadness": "veryUnlikely",
"surprise": "veryUnlikely"
},
"faceRectangle": {
"bottomLeft": {
"x": 176,
"y": 34
},
"bottomRight": {
"x": 428,
"y": 34
},
"topLeft": {
"x": 176,
"y": 327
},
"topRight": {
"x": 428,
"y": 327
}
},
"landmarks": [
{
"kind": "leftPupil",
"x": 229.75856,
"y": 174.96147
}
]
}
]
}
]