Stability-AI / rest-api-support

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

Different Results Between Rest API and DreamStudio #34

Open savy-91 opened 1 year ago

savy-91 commented 1 year ago

Hi!

I am trying to debug why I am getting cropped/ugly images from the REST api whereas with the same prompt and seed I get beautiful images in dreamstudio.

Here is an example:

curl --request POST \
  --url https://api.stability.ai/v1/generation/stable-diffusion-xl-1024-v0-9/text-to-image \
  --header 'Accept: image/png' \
  --header 'Authorization: API_KEY' \
  --header 'content-type: application/json' \
  --data '{
  "height": 512,
  "width": 512,
  "seed": 2147483647,
  "steps": 50,
  "cfg_scale": 20,
  "style_preset": "photographic",
  "text_prompts": [
    {
      "text": "A photo of Tina'\''s cozy and inviting bedroom, with warm lighting and a comfortable bed adorned with soft pillows and blankets.",
      "weight": 1
    },
    {
      "text": "blurry, bad anatomy, disfigured, deformed, bad proportions, blurred, cropped",
      "weight": -1
    }
  ]
}'

Leads to the following image: image

Here are the same inputs, down to cfg_scale, steps and seed: image

And they lead to this output, consistently: 2147483647_A photo of Tina's cozy and inviting bedroom, with _xl-1024-v0-9

I tried inspecting the gprc payload send by dreamstudio but as I imagined I could only see the "text" parts:

���xТ
Mainј
stable-diffusion-xl-1024-v0-9"€
���Ђ?}A photo of Tina's cozy and inviting bedroom, with warm lighting and a comfortable bed adorned with soft pillows and blankets."W
���@їLblurry, bad anatomy, disfigured, deformed, bad proportions, blurred, cropped"
���Ђѕ�*%ЂЂяяяя (22�:-�� A
��Ђ?ъ�Asset�!
Asset

asset-serviceB

At least the model, the prompt and the negative prompts looks the same. Am I missing something here?