Hello Reddit!I try atm to classify an image via the API from Microsoft on nodeJS.The network is alreaday trained and I can "connect" to the my algorithm. I want to send a base64 string as a dataUri but then I get this error-message:ERROR ##################### response: { body: '{"code":"BadRequestImageUrl","message":"Invalid image url"}', headers: { 'content-length': '59', 'content-type': 'application/json; charset=utf-8', 'apim-request-id': 'b66937b3-e998-406c-b320-806eff77ef6f', 'strict-transport-security': 'max-age=31536000; includeSubDomains; preload', 'x-content-type-options': 'nosniff', date: 'Tue, 02 Apr 2019 13:45:44 GMT', connection: 'close' }, statusCode: 400 }, code: 'BadRequestImageUrl', body: { code: 'BadRequestImageUrl', message: 'Invalid image url' } } Here is my code (file: index.js):const PredictionAPIClient = require("azure-cognitiveservices-customvision-prediction"); const predictionKey = "xxxx"; const endPoint = "https://southcentralus.api.cognitive.microsoft.com" const projectId = "xxxxx"; const publishedName = "myMLName"; ... var img = 'iVBORw0KGgoAAAANSUhEUgAAAgAAAAJmCAYAAA...': //base64 ... tempUrl= { url: 'data:image/png;base64,' + img }; ... predictor.classifyImageUrl(projectId, publishedName, tempUrl) .then((resultJSON) => { console.log("RESULT ######################") //console.log(resultJSON);}) .catch((error) => { console.log("ERROR #####################"); console.log(error);} ); The variable "img" is a base64 string (from a FHIR-Observation-Object) and correct (on a webside the url works with the base64).Maybe you can help me to find the error? Idk why the url should be wrong...Thanks for your help guys!Best, MBB_1089Edit: Format
Submitted April 02, 2019 at 03:03PM by MBB_1089
No comments:
Post a Comment