Image Models
Stable Diffusion

In order to deploy the model you can use the identifier below:

  • Stable Diffusion v2: stable-diffusion

We are currently using the “stabilityai/stable-diffusion-2-1” model. Once you’ve deployed a Stable Diffusion model, you can supply the endpoint with string with what image you would like to generate. Here’s an example of how to call the deployed endpoint:

Request Parameters

  curl --location --request POST 'https://run.cerebrium.ai/dreambooth-webhook/predict' \
      --header 'Authorization: <API_KEY>' \
      --header 'Content-Type: application/json' \
      --data-raw '{
        "prompt": "a photo of an astronaut riding a horse on mars.",
        "height": 768,
        "width": 512,
        "num_inference_steps": 60,
        "guidance_scale": 8,
        "num_images_per_prompt": 2,
        "negative_prompt": "no sky",
        "webhook_endpoint": "https://your_url.com"
        }'
Authorizationrequired
string

This is the Cerebrium API key used to authenticate your request. You can get it from your Cerebrium dashboard.

promptrequired
string

The prompt you would like Stable Diffusion to generate.

heightoptional
integer

The height of the generated image which defaults to 512px. This is an optional parameter

widthoptional
integer

The width of the generated image which defaults to 512px. This is an optional parameter

num_inference_stepsoptional
integer

The number of steps you would like Dreambooth to take to generate the image. In general, the results are better the more steps you use, however the more steps, the longer the generation takes. It defaults to 50 steps and is an optional parameter.

guidance_scaleoptional
float

A way to increase the adherence to the conditional signal that guides the generation (text, in this case) as well as overall sample quality. In simple terms it forces the generation to better match the prompt potentially at the cost of image quality or diversity. This defaults to 7.5 and is an optional parameter.

num_images_per_promptoptional
integer

The number of image variations you would like the model to generate. This is an optional parameter which defaults to 1.

negative_promptoptional
string

The negative prompt is a parameter that tells Stable Diffusion what you don’t want to see in the generated images. This is an optional parameter that has an empty default value.

webhook_endpointoptional
string

The url endpoint you would like us to send the image results to once it has finished generating. We recommend this for long running tasks if you are generating multiple images with many steps.

{
    "run_id": "<UUID_STRING>",
    "run_time_ms": <NUMBER>,
    "message": "Successfully generated images",
    "result": [<BASE_64_STRING>]
}

Response Parameters

run_idrequired
string

A unique identifier for the run that you can use to associate prompts with webhook endpoints.

messagerequired
string

Whether of not the response was successful

resultrequired
string

An array of base64 encoded strings of the image that you can convert into an image