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"
}'
This is the Cerebrium API key used to authenticate your request. You can get it from your Cerebrium dashboard.
The prompt you would like Stable Diffusion to generate.
The height of the generated image which defaults to 512px. This is an optional parameter
The width of the generated image which defaults to 512px. This is an optional parameter
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.
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.
The number of image variations you would like the model to generate. This is an optional parameter which defaults to 1.
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.
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
A unique identifier for the run that you can use to associate prompts with webhook endpoints.
Whether of not the response was successful
An array of base64 encoded strings of the image that you can convert into an image
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"
}'
{
"run_id": "<UUID_STRING>",
"run_time_ms": <NUMBER>,
"message": "Successfully generated images",
"result": [<BASE_64_STRING>]
}