Toggle navigation
Toggle navigation
This project
Loading...
Sign in
조아혜
/
cfr-chatbot
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
조아혜
2020-12-03 22:58:00 +0900
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
a7f40ae7dfd3eee773acc8d15dd9b4744195cb82
a7f40ae7
2 parents
9a430881
54ac9b8a
modify package.json
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
1 deletions
cfr_module.js
package.json
cfr_module.js
0 → 100644
View file @
a7f40ae
var
client_id
=
'v3M4wjolGLkrvNA3GUIW'
;
var
client_secret
=
'fKF6vjkWhE'
;
var
fs
=
require
(
'fs'
);
var
request
=
require
(
'request'
);
exports
.
imgtodata
=
function
(
dir
){
var
api_url
=
'https://openapi.naver.com/v1/vision/face'
;
// 얼굴 감지
var
_formData
=
{
image
:
'image'
,
image
:
fs
.
createReadStream
(
__dirname
+
dir
)
// FILE 이름
};
request
.
post
(
{
url
:
api_url
,
formData
:
_formData
,
headers
:
{
'X-Naver-Client-Id'
:
client_id
,
'X-Naver-Client-Secret'
:
client_secret
}
},
(
err
,
response
,
body
)
=>
{
console
.
log
(
response
.
statusCode
);
// 200
//console.log(response.headers['content-type'])
data
=
JSON
.
parse
(
body
);
gender
=
data
.
faces
[
0
].
gender
.
value
;
emotion
=
data
.
faces
[
0
].
emotion
.
value
console
.
log
(
gender
);
console
.
log
(
emotion
);
return
{
gender
:
gender
,
emotion
:
emotion
};
});
}
\ No newline at end of file
package.json
View file @
a7f40ae
...
...
@@ -2,7 +2,7 @@
"name"
:
"reply"
,
"version"
:
"1.0.0"
,
"description"
:
""
,
"main"
:
"
chatbot
.js"
,
"main"
:
"
app
.js"
,
"scripts"
:
{
"test"
:
"echo
\"
Error: no test specified
\"
&& exit 1"
},
...
...
Please
register
or
login
to post a comment