Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
zydjohnHotmail opened this issue Mar 21, 2022 · 0 comments
Open

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

zydjohnHotmail opened this issue Mar 21, 2022 · 0 comments

Comments

@zydjohnHotmail
Copy link

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": ""}",
"param": "",
"location": "body"
}
]
}

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant