Stability-AI / rest-api-support

Stability REST API examples, issues, and discussions | https://api.stability.ai
107 stars 21 forks source link

'style_preset' doesn't work #23

Closed geosem42 closed 1 year ago

geosem42 commented 1 year ago

I'm trying now the new 'style_preset' but it doesn't work, passing a value doesn't do anything.

However, specifying the style manually in the prompt works.

Even passing the value manually doesn't do anything style_preset: 'anime'

const { res: result, images } = await generateAsync({
        prompt,
        apiKey,
        height: height,
        width: width,
        cfg_scale: 7,
        steps: 50,
        num_samples: 1,
        engine: 'stable-diffusion-xl-beta-v2-2-2',
        style_preset // or style_preset: style_preset
})
brianfitzgerald commented 1 year ago

Hi Geosemaan, do you mind sharing the details of your generateAsync function, or what the body and URL of your request look like? Just tried to reproduce your request with the following cURL:

curl --request POST \
  --url https://api.stability.ai/v1/generation/stable-diffusion-xl-beta-v2-2-2/text-to-image \
  --header 'Accept: image/png' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "text_prompts": [
        {
            "text": "dog on a swing"
        }
    ],
    "cfg_scale": 7,
    "steps": 50,
    "sampler": "DDIM",
    "style_preset": "anime"
}'

and got the expected response.

geosem42 commented 1 year ago

Hello Brian, I'm using stability-client package: https://www.npmjs.com/package/stability-client

It looks like it hasn't been updated yet. I tried patching it locally for testing, it didn't work.

brianfitzgerald commented 1 year ago

Ah! That makes sense. That is a third party client that is not supported by Stability. I would open an issue / PR on their repo, or in the meantime, you can reference our TypeScript code examples here: https://api.stability.ai/docs#tag/v1generation/operation/textToImage

brianfitzgerald commented 1 year ago

Going to close this issue since we've determined a root cause, but feel free to ping me or raise again if you run into other issues.