目前我可以使用 url 作为我的分类图像 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);}
);
});