-
Notifications
You must be signed in to change notification settings - Fork 0
/
analytics.js
42 lines (37 loc) · 1.14 KB
/
analytics.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
'use strict'
let request = require('request-promise');
module.exports = {
getDescription: (imageUrl) => {
return request({
method: "POST",
uri: "https://api.projectoxford.ai/vision/v1.0/analyze?visualFeatures=Description",
headers: { 'Ocp-Apim-Subscription-Key': process.env.MS_COMPUTER_VISION_TOKEN },
body: { url: imageUrl },
json: true
})
},
getFaces: (imageUrl) => {
return request({
method: "POST",
uri: "https://api.projectoxford.ai/vision/v1.0/analyze?visualFeatures=Faces",
headers: { 'Ocp-Apim-Subscription-Key': process.env.MS_COMPUTER_VISION_TOKEN },
body: { url: imageUrl },
json: true
})
},
getEmotions: (imageUrl) => {
return request({
method: "POST",
uri: "https://westeurope.api.cognitive.microsoft.com/face/v1.0/detect",
headers: { 'Ocp-Apim-Subscription-Key': process.env.MS_FACE_API_KEY },
qs: {
'returnFaceId': 'false',
returnFaceRectangle: 'false',
'returnFaceLandmarks': 'false',
'returnFaceAttributes': 'emotion'
},
body: { url: imageUrl },
json: true
})
},
}