"num_images_per_prompt" in Inference Endpoint request with a text-to-image model

Hi community,

I’m using a dedicated Inference Endpoint with a text-to-image model (stable-diffusion-xl-base-1-0-cqq).

  • The documentation indicates, that I could use the parameter “num_images_per_prompt”. I experimentally set this parameter to 2 in my request, but the response base64 encoded string does not seem to contain two images.
    How would I use this parameter correctly?

This is my curl request

curl "https://some_instance.eu-west-1.aws.endpoints.huggingface.cloud"   \
  -X POST \
  -H "Accept: application/json"  \
  -H "Authorization: Bearer hf_XYZ..." \
  -H "Content-Type: application/json" \
  -d '{ "inputs": "a cat sitting on a mirror", "parameters": { "num_images_per_prompt" : 2 }}' \ 
  > response.txt

In the response I’m searching actually for the Base64 header (iVBORw0KGgo) for png images… I can only find one.

  • Another question would be, can I use multiple prompts in one request ?

So something like:

curl "https://some_instance.eu-west-1.aws.endpoints.huggingface.cloud"  \
 -X POST  \
 -H "Accept: application/json" \
 -H "Authorization: Bearer hf_XYZ..." \
 -H "Content-Type: application/json"  \
 -d '{ "inputs": [ "a cat sitting on a mirror", "a dog sitting on a mirror" ]}'  \
 > response.txt

I tried this and it seems the model takes nearly the doubled time to perform the generation, thus assuming it did generate two images. But again in the response I do only find one image.