当前,我可以使用url作为我的classifyImage URL,但是我想改用base64string。但是,当我尝试这样做时,我收到了BadRequestImageFormat错误消息。我该怎么办?
app.post('/predict', function(req, res){
const predictionKey = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
const endPoint = "https://southcentralus.api.cognitive.microsoft.com"
const projectId = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
const publishedName = "AntiScam";
const PredictionApiClient = require("azure-cognitiveservices-customvision-prediction");
const predictor = new PredictionApiClient(predictionKey, endPoint);
var data2 = req.body.img;
tempData={ url: data2 };
predictor.classifyImageUrl(projectId, publishedName, tempData)
.then((resultJSON) => {
console.log("RESULT ######################")
console.log(resultJSON);
res.send(resultJSON);})
.catch((error) => {
console.log("ERROR #####################");
console.log(error);}
);
});
答案 0 :(得分:0)
仅受支持的请求是multipart/form-data
或通过提供图像的URL。所以不,base64字符串似乎不受支持。