AUTOMATIC1111 / stable-diffusion-webui

Stable Diffusion web UI
GNU Affero General Public License v3.0
139.46k stars 26.44k forks source link

[Bug]: list indices must be integers or slices, not str in txt2img api with x/y/z plot script #11736

Closed mayur-rank closed 1 year ago

mayur-rank commented 1 year ago

Is there an existing issue for this?

What happened?

getting Error message with /sdapi/v1/txt2img

{
    "error": "TypeError",
    "detail": "",
    "body": "",
    "errors": "list indices must be integers or slices, not str"
}

Steps to reproduce the problem

request body

{
    "enable_hr": false,
    "prompt": "fair girl, white skin, ((yellow jacket:1.5)), (white tshirt), (wrist watch:1.5), (background mountain:1.5), realistic, ultra hd, 8k, ",
    "seed": -1,
    "negative_prompt": "(nsfw:1.5),(((simple background))),monochrome ,lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry, lowres, bad anatomy, bad hands, text, error, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry, ugly,pregnant,vore,duplicate,morbid,mut ilated,tran nsexual, hermaphrodite,long neck,mutated hands,poorly drawn hands,poorly drawn face,mutation,deformed,blurry,bad anatomy,bad proportions,malformed limbs,extra limbs,cloned face,disfigured,gross proportions, (((missing arms))),(((missing legs))), (((extra arms))),(((extra legs))),pubic hair, plump,bad legs,error legs,username,blurry,bad feet",
    "sampler_name": "Euler",
    "batch_size": 1,
    "n_iter": 1,
    "steps": 30,
    "cfg_scale": 7,
    "denoising_strength": 0.7,
    "width": 480,
    "height": 872,
    "sampler_index": "Euler",
    "send_images": true,
    "script_name": "x/y/z plot",
    "script_args": ["Prompt S/R",  "girl, boy",  "Nothing", "",  "Nothing", "", false, false ,false,true,1]
}

What should have happened?

Facing error

Version or Commit where the problem happens

v1.4.0

What Python version are you running on ?

Python 3.10.x

What platforms do you use to access the UI ?

Linux

What device are you running WebUI on?

No response

Cross attention optimization

xformers

What browsers do you use to access the UI ?

No response

Command Line Arguments

No

List of extensions

No

Console logs

No

Additional information

No

chrme commented 1 year ago

Try like this:

"script_name": "x/y/z plot",
"script_args": [
                    7,           # x_type
                    "girl, boy", # x_values
                    "",          # x_values_dropdown
                    0,           # y_type
                    "",          # y_values
                    "",          # y_values_dropdown
                    0,           # z_type
                    "",          # z_values
                    "",          # z_values_dropdown
                    True,        # draw_legend
                    False,       # include_lone_images
                    False,       # include_sub_grids
                    False,       # no_fixed_seeds
                    1            # margin_size
                ]

Where type is:

Text2Img types:
    0 = Nothing
    1 = Seed
    2 = Var. seed
    3 = Var. strength
    4 = Steps
    5 = Hires steps
    6 = CFG Scale
    7 = Prompt S/R
    8 = Prompt order
    9 = Sampler
    10 = Checkpoint name
    11 = Negative Guidance minimum sigma
    12 = Sigma Churn
    13 = Sigma min
    14 = Sigma max
    15 = Sigma noise
    16 = Schedule type
    17 = Schedule min sigma
    18 = Schedule max sigma
    19 = Schedule rho
    20 = Eta
    21 = Clip skip
    22 = Denoising
    23 = Hires upscaler
    24 = VAE
    25 = Styles
    26 = UniPC Order
    27 = Face restore
    28 = Token merging ratio
    29 = Token merging ratio high-res

Img2Img types:
    0 = Nothing
    1 = Seed
    2 = Var. seed
    3 = Var. strength
    4 = Steps
    5 = CFG Scale
    6 = Image CFG Scale
    7 = Prompt S/R
    8 = Prompt order
    9 = Sampler
    10 = Checkpoint name
    11 = Negative Guidance minimum sigma
    12 = Sigma Churn
    13 = Sigma min
    14 = Sigma max
    15 = Sigma noise
    16 = Schedule type
    17 = Schedule min sigma
    18 = Schedule max sigma
    19 = Schedule rho
    20 = Eta
    21 = Clip skip
    22 = Denoising
    23 = Cond. Image Mask Weight
    24 = VAE
    25 = Styles
    26 = UniPC Order
    27 = Face restore
    28 = Token merging ratio
    29 = Token merging ratio high-res
mayur-rank commented 1 year ago

It's working, thanks for this