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-06 02:07:08 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
1049f449162f45ddc557198faf4838e7cae1b914
1049f449
1 parent
35b18760
del file
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
54 deletions
cfr_module.js
cfr_module.js
deleted
100644 → 0
View file @
35b1876
var
client_id
=
'v3M4wjolGLkrvNA3GUIW'
;
var
client_secret
=
'fKF6vjkWhE'
;
var
fs
=
require
(
'fs'
);
var
request
=
require
(
'request'
);
const
path
=
require
(
'path'
);
var
express
=
require
(
'express'
);
var
app
=
express
();
var
domain
=
"www.osstest237.ml"
const
sslport
=
23023
;
const
HTTPS
=
require
(
'https'
);
exports
.
imgtodata
=
function
(
dir
){
var
api_url
=
'https://openapi.naver.com/v1/vision/face'
;
// 얼굴 감지
var
_formData
=
{
image
:
'image'
,
image
:
fs
.
createReadStream
(
path
.
join
(
__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};
});
}
try
{
const
option
=
{
ca
:
fs
.
readFileSync
(
'/etc/letsencrypt/live/'
+
domain
+
'/fullchain.pem'
),
key
:
fs
.
readFileSync
(
path
.
resolve
(
process
.
cwd
(),
'/etc/letsencrypt/live/'
+
domain
+
'/privkey.pem'
),
'utf8'
).
toString
(),
cert
:
fs
.
readFileSync
(
path
.
resolve
(
process
.
cwd
(),
'/etc/letsencrypt/live/'
+
domain
+
'/cert.pem'
),
'utf8'
).
toString
(),
};
HTTPS
.
createServer
(
option
,
app
).
listen
(
sslport
,
()
=>
{
console
.
log
(
`[HTTPS] Server is started on port
${
sslport
}
`
);
});
}
catch
(
error
)
{
console
.
log
(
'[HTTPS] HTTPS 오류가 발생하였습니다. HTTPS 서버는 실행되지 않습니다.'
);
console
.
log
(
error
);
}
//imgtodata('./test3.jpg');
\ No newline at end of file
Please
register
or
login
to post a comment