I am currently using Node-red in HA. I am attempting to push a JPG to Codeproject AI local server to get an OCR response back. I am getting responses back from the server, but I don't think it's getting the jpg data. As it always errors out in 6ms or less. My code is below. I can't figure out how to past it correctly. There is no </> button. Where am I going wrong?
[{"id":"fdf45dde0884a088","type":"inject","z":"4f64858a3d766e69","name":"","props":[{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":110,"y":600,"wires":[["6ab53aa60a5a28ac"]]},{"id":"25bd7939565752ad","type":"debug","z":"4f64858a3d766e69","name":"debug 15","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":640,"y":480,"wires":[]},{"id":"0a5e31bf976b3eac","type":"http request","z":"4f64858a3d766e69","name":"","method":"POST","ret":"obj","paytoqs":"body","url":"http://10.146.1.30:32168/v1/image/ocr","tls":"","persist":true,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[{"keyType":"Content-Type","keyValue":"","valueType":"image/jpeg","valueValue":""}],"x":490,"y":480,"wires":[["25bd7939565752ad"]]},{"id":"6ab53aa60a5a28ac","type":"file in","z":"4f64858a3d766e69","name":"","filename":"/config/save_data/test1.jpg","filenameType":"str","format":"","chunk":false,"sendError":false,"encoding":"hex","allProps":false,"x":240,"y":480,"wires":[["0a5e31bf976b3eac"]]}]
The code below is from the Codepoject AI web site and works if i load it on a web browser.
<html>
<body>
Detect the scene in this file: <input id="image" type="file" />
<input type="button" value="Detect Scene" onclick="detectScene(image)" />
<script>
function detectScene(fileChooser) {
var formData = new FormData();
formData.append('image', fileChooser.files[0]);
fetch('http://localhost:32168/v1/image/ocr', {
method: "POST",
body: formData
})
.then(response => {
if (response.ok) response.json().then(data => {
console.log(`Scene is ${data.label}, ${data.confidence} confidence`)
});
});
}
</script>
</body>
</html>