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
daeun
2020-12-02 01:35:57 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
e6cdd857572322bc69170dbe72dac9172180ef68
e6cdd857
1 parent
2af9616f
modify cfr_test for data parsing
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
5 deletions
cfr_test.js
cfr_test.js
View file @
e6cdd85
...
...
@@ -3,6 +3,8 @@ var app = express();
var
client_id
=
'v3M4wjolGLkrvNA3GUIW'
;
var
client_secret
=
'fKF6vjkWhE'
;
var
fs
=
require
(
'fs'
);
//var bodyParser=require('body-parser');
//app.use(bodyParser.json());
app
.
get
(
'/'
,
function
(
req
,
res
)
{
var
request
=
require
(
'request'
);
...
...
@@ -11,17 +13,26 @@ app.get('/', function (req, res) {
var
_formData
=
{
image
:
'image'
,
image
:
fs
.
createReadStream
(
__dirname
+
"\\IU.jpg"
)
// FILE 이름
image
:
fs
.
createReadStream
(
__dirname
+
"\\
사진\\
IU.jpg"
)
// FILE 이름
};
var
_req
=
request
.
post
({
url
:
api_url
,
formData
:
_formData
,
headers
:
{
'X-Naver-Client-Id'
:
client_id
,
'X-Naver-Client-Secret'
:
client_secret
}}).
on
(
'response'
,
function
(
response
)
{
var
_req
=
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
(
emotion
);
});
console
.
log
(
request
.
head
);
console
.
log
(
request
.
head
);
_req
.
pipe
(
res
);
// 브라우저로 출력
});
app
.
listen
(
8080
,
function
()
{
console
.
log
(
'http://127.0.0.1:8080
/face
app listening on port 8080!'
);
console
.
log
(
'http://127.0.0.1:8080 app listening on port 8080!'
);
});
\ No newline at end of file
...
...
Please
register
or
login
to post a comment