Closed alexsluborski77 closed 4 months ago
your payload does not look anything like a web you are img2img payload it should look something like this
{
"prompt": "",
"negative_prompt": "",
"styles": [
"string"
],
"seed": -1,
"subseed": -1,
"subseed_strength": 0,
"seed_resize_from_h": -1,
"seed_resize_from_w": -1,
"sampler_name": "string",
"scheduler": "string",
"batch_size": 1,
"n_iter": 1,
"steps": 50,
"cfg_scale": 7,
"width": 512,
"height": 512,
"restore_faces": true,
"tiling": true,
"do_not_save_samples": false,
"do_not_save_grid": false,
"eta": 0,
"denoising_strength": 0.75,
"s_min_uncond": 0,
"s_churn": 0,
"s_tmax": 0,
"s_tmin": 0,
"s_noise": 0,
"override_settings": {},
"override_settings_restore_afterwards": true,
"refiner_checkpoint": "string",
"refiner_switch_at": 0,
"disable_extra_networks": false,
"firstpass_image": "string",
"comments": {},
"init_images": [
"string"
],
"resize_mode": 0,
"image_cfg_scale": 0,
"mask": "string",
"mask_blur_x": 4,
"mask_blur_y": 4,
"mask_blur": 0,
"mask_round": true,
"inpainting_fill": 0,
"inpaint_full_res": true,
"inpaint_full_res_padding": 0,
"inpainting_mask_invert": 0,
"initial_noise_multiplier": 0,
"latent_mask": "string",
"force_task_id": "string",
"sampler_index": "Euler",
"include_init_images": false,
"script_name": "string",
"script_args": [],
"send_images": true,
"save_images": false,
"alwayson_scripts": {},
"infotext": "string"
}
if you have trouble creating payload yourself then use the Web Interface + https://github.com/huchenlei/sd-webui-api-payload-display to to generate the payload for you
422 is most likely trigger by your specifying a non-existent script / extension
Ok thanks, I was missing a big chunk of the payload, I think this a problem due to controlnet script
"alwayson_scripts": {
"controlnet": {
"args": controlNetArgs
located at the end of the payload. I have to look in docs to confirm how it can find this script, im sure it is outlined somewhere? If by non-existent, you mean it is not in the file system, there is a specific folder to place?
I figured it out, was not installing in the right directory needs to be in data folder in extensions->controlnet->models. I was getting the controlnet from hugging face. Is it possible to try add more verbose logging about issues with payload or missing scripts in api.py related to 422?
Is it possible to try add more verbose logging about issues with payload or missing scripts in api.py related to 422?
thing is we did put "more verbose logs", I'm not sure why but the the more useful messages is not displayed by the client.
there are three 422 inside modules/api/api.py this is 2/3 https://github.com/AUTOMATIC1111/stable-diffusion-webui/blob/feee37d75f1b168768014e4634dcb156ee649c05/modules/api/api.py#L351-L355
I have to look in docs to confirm how it can find this script, im sure it is outlined somewhere? If by non-existent, you mean it is not in the file system, there is a specific folder to place?
I'm afraid we don't have good documentations
use https://github.com/huchenlei/sd-webui-api-payload-display It's relatively easy to learn with actual examples of a payload
the best documentation we have in house is this https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/API I have example script that you can try, I recall I also included a control-net payload example but it's most likely outdated so you most likely will still have to create your new payload using sd-webui-api-payload-display
Checklist
What happened?
I am running auto1111 in docker container and hitting it through another web server exposed through application load balancer. I have the auto1111 enabled with api and I can confirm everything works fine and is loaded but I am having trouble getting my payload request through for img2img render endpoints.
This is the curl method im using with Windows Powershell currently as that is the machine I have access to:
Invoke-RestMethod -Uri 'https://load-balancer-url/render5' -Method Post -Headers @{ 'Access-Token' = "$accessToken"; 'From'= 'user@email'; 'accept' = 'application/json'; 'Content-Type' = 'application/json' } -Body $jsonData -Verbose
http://127.0.0.1:7860/sdapi/v1/img2img
is what the server redirects to since it is in docker container network but that load-balancer is used for accessing from internet.When I run this command I get this error:
Render failed due to the following error: Error: ('422 Client Error: Unprocessable Entity for url')
The access token and email is correct and working fine (JWT token)This is my json payload...
I can't get any more verbose error logging either from the --api-log or from container logs as well as ssh as to whats wrong with the response body. Could anyone assist as to what its complaining about? What is the unprocessable entity here? I am using
release-candidate
branch here with commit hashcf2772fab0af5573da775e7437e6acdca424f26e
.This is the docker file with command line args
Steps to reproduce the problem
I run docker container with this file and attempt the curl command and I get this error with no other verbose logging. with --verbose flag on curl I get something like this but not much more helpful.
What should have happened?
It should process POST request with JSON payload succesfully.
What browsers do you use to access the UI ?
Google Chrome
Sysinfo
Not using WebUI
Console logs