我正在使用计算机视觉 Api 并尝试使用节点 js 将图像从 url 发布到 ocr 微软认知服务,但我得到了
{"code":"InvalidImageUrl","requestId":"a4c68f18-37c1-484d-a044-2f89df963915","message":"Can't fetch the image."}
这是我的获取和发布代码
http.get(url.parse(imageUrl), function (res) {
res.on('data',function (body) {
console.log('data from get '+body);
})
res.on('end', function () {
request.post({
headers: {
'Ocp-Apim-Subscription-Key': proccess.env.SUBSKEY
},
url: 'http://api.projectoxford.ai/vision/v1.0/ocr?language=unk&detectOrientation=true',
encoding: 'binary',
formdata:{
file:res
}
}, function (error, response, body) {
if(error)
{
console.log(error);
}
console.log('data from post '+body);
});
});
});
我也在使用 botbuilder