This message was deleted.
# ask-for-help
s
This message was deleted.
s
Looks like you're not specifying the content type in of your image in your
MultipartEncoder
?
l
I printed the m.content_type for the second chunk of code, and it gives me
Copy code
multipart/form-data; boundary=b67d737b1cc94a55a76d95da35648314
Is this what you are suggesting?
s
No, the content type of the file itself inside the multipart form is not being set.
l
I guess the content type is sent here in the requests.post function
Copy code
res = <http://requests.post|requests.post>(
        "<http://0.0.0.0:3000/predict>", data=m, headers={"Content-Type": m.content_type}
    )
If not, can you show me an example of how to specify the content type in the image? For example, my content type is image/jpeg.
s
Copy code
m = MultipartEncoder(
        fields={
        "image": ('abc.jpg', open("/projects/ff_project/users/ff_li/_nasHome/project/ff-lib/bento/abc.jpg", "rb"), 'image/jpeg'),
        "img_type":('', 'mic'),
        "bbox": ('', '[0,0,100,100]'),
        }
    )
l
Oh sorry, I did specify the 'image/jpeg' in my code but I forgot to put it here. I still have this issue even if the image content type is explicitly specified.
s
Hm, and the error is the same even with the content type specified? Does it work if you use the swagger UI?
l
I haven't tried swagger UI before. Is there any other method that I can try to detect the issue?
s
Sure, you can use curl or any other request library, if it's still a problem then it might be a bug with BentoML, otherwise it's an issue with the request, somehow or other.
l
I tried CURL in the terminal shell. It still didn't work. So it might be a bug with BentoML?
s
Can you paste the command?
l
Copy code
curl -X POST -H "Content-Type: multipart/form-data"  -F image=@/projects/ff_project/users/ff_li/_nasHome/project/ff-lib/bento/abc.jpg -F img_type='mic' -F bbox='[0,0,100,100]' <http://0.0.0.0:3000/predict>
s
Thanks! Can you open an issue so we can track this one?
l
Will do. Thanks for the help.