lobe.NET icon indicating copy to clipboard operation
lobe.NET copied to clipboard

How to upload image for lobe trained model in local host?

Open zydjohnHotmail opened this issue 3 years ago • 0 comments

Hello: I have trained an image converter model in Lobe (version 0.10.1130.5). I also exported as an ONNX model. But I don’t know how to write some C# code to make some predication. However, I found that I can use Lobe locally and post image to it. So I want to try this model. I run Lobe in Lobe Connect, and I can see its local URL: http://localhost:38101/v1/predict/2cc072ae-dbda-43c5-8db7-4c2515e0548d

However, the HTTP request is in this format: { "method": "POST", "headers": { "Content-Type": "application/json" }, "body": { "image": "" } }

I used one C# program to convert one of the training image to base64 string. Then I launch PostMan (Version 9.15.2) for Windows 10 to post the following Json data to local lobe connect end-point, like this: { "method": "POST", "headers": { "Content-Type": "application/json" }, "body": { "image": "iVBORw0KGgoAAAANSUhEUgAABAAAAAQACAIAAADwf7zUAAEAAE......==" } }

Then I quickly get response from lobe end-point, with the following Json reply: { "errors": [ { "value": "{ "method": "POST", "headers": { "Content-Type": "application/json" }, "body": {
"image": "iVBORw0KGgoAAAANSUhEUgAABAAAAAQACAIAAADwf7zUAAEAAE......==" }}", "msg": "Request body should be {"image": "<Base64 encoded string of your image>"}", "param": "", "location": "body" } ] }

It seems Lobe connect does NOT recognize the base64 as an image. Please advise on how to fix this?

zydjohnHotmail avatar Mar 21 '22 15:03 zydjohnHotmail