Toggle navigation
Toggle navigation
This project
Loading...
Sign in
은승우
/
LINEBOT
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
은승우
2019-12-05 16:20:49 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
31dfab149c345e5b6e5766617832980fdad45313
31dfab14
1 parent
88a34b2f
Update app.js
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
6 deletions
app.js
app.js
View file @
31dfab1
...
...
@@ -89,26 +89,24 @@ async function handleEvent(event) {
client
.
getMessageContent
(
event
.
message
.
id
)
.
then
((
stream
)
=>
{
stream
.
on
(
'data'
,
(
chunk
)
=>
{
fs
.
writeFileSync
(
'
image
.png'
,
chunk
);
fs
.
writeFileSync
(
'
/photo/1
.png'
,
chunk
);
});
});
var
cheerio
=
require
(
'cheerio'
);
var
imageUrl
=
'oss.chatbot.bu.to/photo/1.png'
;
var
uriBase
=
'https://koreacentral.api.cognitive.microsoft.com/vision/v2.1/ocr'
;
var
options
=
{
uri
:
uriBase
,
qs
:
{
visualFeatures
:
'Categories'
,
details
:
''
,
language
:
'en'
'language'
:
'unk'
,
'detectOrientation'
:
'true'
,
},
headers
:
{
'Content-Type'
:
'application/json'
,
'Ocp-Apim-Subscription-Key'
:
'979dc5d63344438fa4701c62feebb7dc'
},
body
:
'{"url": '
+
'"'
+
imageUrl
+
'"}'
,
body
:
fs
.
readFileSync
(
'/photo/1.png'
)
};
console
.
log
(
body
);
request
.
post
(
options
,
function
(
error
,
response
,
body
)
{
...
...
Please
register
or
login
to post a comment