stable-diffusion-webui-forge icon indicating copy to clipboard operation
stable-diffusion-webui-forge copied to clipboard

Calling the API /sdapi/v1/txt2img for text-to-image

Open maxin9966 opened this issue 6 months ago • 9 comments

The API call is /sdapi/v1/txt2img, with the following parameters being passed. The returned image seems to have issues, appearing notably coarser compared to images generated through the web interface. For instance, the texture of the hair is particularly noticeable. Could you identify which parameter was input incorrectly? Could you provide a typical set of parameters for this API call?

payload = {
    "prompt": prompt,
    "negative_prompt": "",
    "seed": -1,
    "subseed": -1,
    "subseed_strength": 0,
    "seed_resize_from_h": -1,
    "seed_resize_from_w": -1,
    "sampler_name": "Euler",
    "scheduler": "Simple",
    "batch_size": 1,
    "n_iter": 1,
    "steps": 4,
    "cfg_scale": 1,
    "distilled_cfg_scale": guidance, # 3.5
    "width": width,
    "height": height,
    "sampler_index": "Euler"
}

image

maxin9966 avatar Aug 15 '24 15:08 maxin9966