은승우

Update app.js

Showing 1 changed file with 4 additions and 6 deletions
......@@ -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) {
......