Skip to content

Instantly share code, notes, and snippets.

@conanak99

conanak99/index.js

Last active Apr 14, 2018
Embed
What would you like to do?
const rp = require('request-promise');
async function detectImage(source) {
const subscriptionKey = "[thay bằng key của bạn]";
const uri = "https://westcentralus.api.cognitive.microsoft.com/face/v1.0/detect";
const options = {
uri,
qs: {
returnFaceId: true,
returnFaceLandmarks: true, // Nhận diện các điểm trên khuôn mặt
},
method: 'POST',
headers: {
'Ocp-Apim-Subscription-Key': subscriptionKey
},
body: {
url: source
},
json: true
};
const result = await rp(options);
return result;
}
(async () => {
const imageUrl = 'https://pbs.twimg.com/media/DWr05hUXcAA9s8n.jpg'
const result = await detectImage(imageUrl);
console.log(JSON.stringify(result, null, 2));
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.