Skip to content
This repository has been archived by the owner on Dec 10, 2023. It is now read-only.

用api调用多帧渲染的脚本的时候报错 #32

Open
hexiaochun opened this issue Apr 27, 2023 · 0 comments
Open

用api调用多帧渲染的脚本的时候报错 #32

hexiaochun opened this issue Apr 27, 2023 · 0 comments

Comments

@hexiaochun
Copy link

hexiaochun commented Apr 27, 2023

用webui界面去调用的时候是没有问题的
用api去调用的时候就报一个mask读取失败的错误,导致controlnet 没有效果

api的请求参数如下:
` ``
res = api.img2img(images=[input_img],inpainting_fill=1,mask_blur=4,mask_image=None,inpaint_full_res=0,inpaint_full_res_padding=32
,prompt=words,negative_prompt=data["negative_prompt"],seed=data["seed"],
cfg_scale=data["cfg_scale"],denoising_strength=data["denoising_strength"]
,restore_faces=True,width=w,height=h,steps=data["steps"],sampler_name=data["sampler_name"],batch_size=1,controlnet_units=[unit1,unit2]
,script_name="multi-frame rendering",script_args=[
'None',
input_path,
output_path,
'',
data["denoising_strength"],
"FirstGen",

                True,
                False,
                "Current",
                False,
                '1 2 3 \r\n 0',
                
                False,
                "",
                True,
                '',
                False,
                '',
                False,
                *['','']
            ])

对比了一下网页送入的参数是一致的,怀疑是p这个参数里面的值不一致,又做了对比发现也是一样的,
错误信息如下:

image:
Error running process: /root/autodl-tmp/stable-diffusion-webui/extensions/sd-webui-controlnet/scripts/controlnet.py
Traceback (most recent call last):
File "/root/autodl-tmp/stable-diffusion-webui/modules/api/api.py", line 63, in decode_base64_to_image
image = Image.open(BytesIO(base64.b64decode(encoding)))
File "/root/miniconda3/lib/python3.10/site-packages/PIL/Image.py", line 3283, in open
raise UnidentifiedImageError(msg)
PIL.UnidentifiedImageError: cannot identify image file <_io.BytesIO object at 0x7f38587d7f10>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/root/autodl-tmp/stable-diffusion-webui/modules/scripts.py", line 417, in process
script.process(p, *script_args)
File "/root/autodl-tmp/stable-diffusion-webui/extensions/sd-webui-controlnet/scripts/controlnet.py", line 941, in process
image = image_dict_from_any(unit.image)
File "/root/autodl-tmp/stable-diffusion-webui/extensions/sd-webui-controlnet/scripts/controlnet.py", line 144, in image_dict_from_any
image['mask'] = external_code.to_base64_nparray(image['mask'])
File "/root/autodl-tmp/stable-diffusion-webui/extensions/sd-webui-controlnet/scripts/external_code.py", line 111, in to_base64_nparray
return np.array(api.decode_base64_to_image(encoding)).astype('uint8')
File "/root/autodl-tmp/stable-diffusion-webui/modules/api/api.py", line 66, in decode_base64_to_image
raise HTTPException(status_code=500, detail="Invalid encoded image")
fastapi.exceptions.HTTPException

请问这个该从哪个地方入手

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

No branches or pull requests

1 participant