Showing
3 changed files
with
48 additions
and
0 deletions
cfr_test.js
0 → 100644
1 | +var express = require('express'); | ||
2 | +var app = express(); | ||
3 | +var client_id = 'v3M4wjolGLkrvNA3GUIW'; | ||
4 | +var client_secret = 'fKF6vjkWhE'; | ||
5 | +var fs = require('fs'); | ||
6 | + | ||
7 | +app.get('/', function (req, res) { | ||
8 | + var request = require('request'); | ||
9 | + //var api_url = 'https://openapi.naver.com/v1/vision/celebrity'; // 유명인 인식 | ||
10 | + var api_url = 'https://openapi.naver.com/v1/vision/face'; // 얼굴 감지 | ||
11 | + | ||
12 | + var _formData = { | ||
13 | + image:'image', | ||
14 | + image: fs.createReadStream(__dirname + "\\IU.jpg") // FILE 이름 | ||
15 | + }; | ||
16 | + var _req = request.post({url:api_url, formData:_formData, | ||
17 | + headers: {'X-Naver-Client-Id':client_id, 'X-Naver-Client-Secret': client_secret}}).on('response', function(response) { | ||
18 | + console.log(response.statusCode) // 200 | ||
19 | + console.log(response.headers['content-type']) | ||
20 | + }); | ||
21 | + console.log( request.head ); | ||
22 | + _req.pipe(res); // 브라우저로 출력 | ||
23 | + }); | ||
24 | + | ||
25 | + app.listen(8080, function () { | ||
26 | + console.log('http://127.0.0.1:8080/face app listening on port 8080!'); | ||
27 | + }); | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
package-lock.json
0 → 100644
This diff is collapsed. Click to expand it.
package.json
0 → 100644
1 | +{ | ||
2 | + "name": "oss-cfr", | ||
3 | + "version": "1.0.0", | ||
4 | + "description": "oss-cfr", | ||
5 | + "main": "cfr_test.js", | ||
6 | + "dependencies": { | ||
7 | + "express": "^4.17.1", | ||
8 | + "fs": "^0.0.1-security", | ||
9 | + "request": "^2.88.2" | ||
10 | + }, | ||
11 | + "devDependencies": {}, | ||
12 | + "scripts": { | ||
13 | + "test": "echo \"Error: no test specified\" && exit 1" | ||
14 | + }, | ||
15 | + "repository": { | ||
16 | + "type": "git", | ||
17 | + "url": "http://khuhub.khu.ac.kr/2018102237/cfr-chatbot.git" | ||
18 | + }, | ||
19 | + "author": "daeun", | ||
20 | + "license": "ISC" | ||
21 | +} |
-
Please register or login to post a comment