Closed samuelgdc closed 8 months ago
@samuelgdc
you can get example here
if you use /v1/generation/image-prompt
, image should be bytes and you need submit a form request
if you use /v2/generation/image-prompt
, image should be base64 and post a json data
@samuelgdc
you can get example here
if you use
/v1/generation/image-prompt
, image should be bytes and you need submit a form requestif you use
/v2/generation/image-prompt
, image should be base64 and post a json data
In V2, there seems to be an issue on the API side with base64 decoding, causing the error message "binascii.Error: Incorrect padding". I've tried various approaches to fix it, but none have been successful. I'm sending requests through PHP, but it's not working. I've attempted to add padding and tried other solutions, but so far, nothing has worked for me.
@bsormagec Can you provide the actual data requested? Contains image in base64 format。It would be better if you could show me the request code.
I noticed a difference between how I prepare images in PHP and how your test codes encode them. When we send a base64 image request in PHP, we typically add a string at the beginning of the base64 image code, like data:image/png;base64,
. However, I noticed that you encode needs to generate this string. While PHP can parse and exclude it before calculating the hash, this isn't the case with Python. So, I think you should check for and split the string on the backend if it exists. Doing so will make it compatible with all other image base64 standards, as base64 image standards must start with the "data:image/png;base64," string.
I also encountered a file size error when sending larger face files. Please check whether there are any limitations on file uploads or request body limits on the v2 endpoints. Thank you.
@bsormagec Can you provide the actual data requested? Contains image in base64 format。It would be better if you could show me the request code.
@bsormagec thx for your issue, I submitted an update that can solve the problem of base64 image format. In addition, with regard to the size limit of POST, I'm sure there are no settings in my code, including the fastapi framework. Can you provide me with the running information of the command line and the error returns you received?
When sending a request to the api with this: "cn_img": "string"
Can it be the image url? If so, how is it formated? Because when I try with the URL or base64 I get an error.