조아혜

delete module.js

1 -var client_id = 'v3M4wjolGLkrvNA3GUIW';
2 -var client_secret = 'fKF6vjkWhE';
3 -var fs = require('fs');
4 -var request = require('request');
5 -
6 -exports.imgtodata=function(dir){
7 - var api_url = 'https://openapi.naver.com/v1/vision/face'; // 얼굴 감지
8 -
9 - var _formData = {
10 - image:'image',
11 - image: fs.createReadStream(__dirname + dir) // FILE 이름
12 - };
13 -
14 - request.post(
15 - { url:api_url,
16 - formData:_formData,
17 - headers: {'X-Naver-Client-Id':client_id,
18 - 'X-Naver-Client-Secret': client_secret}
19 - }, (err,response,body) =>{
20 - console.log(response.statusCode); // 200
21 - //console.log(response.headers['content-type'])
22 -
23 - data=JSON.parse(body);
24 - gender=data.faces[0].gender.value;
25 - emotion=data.faces[0].emotion.value
26 -
27 - console.log(gender);
28 - console.log(emotion);
29 -
30 - return {gender:gender,emotion:emotion};
31 - });
32 - }
...\ No newline at end of file ...\ No newline at end of file