You're looking at a specific version of this model. Jump to the model overview.
stability-ai /stable-diffusion:ac732df8
Input
Run this model in Node.js with one line of code:
npm install replicate
REPLICATE_API_TOKEN
environment variable:export REPLICATE_API_TOKEN=<paste-your-token-here>
Find your API token in your account settings.
import Replicate from "replicate";
const replicate = new Replicate({
auth: process.env.REPLICATE_API_TOKEN,
});
Run stability-ai/stable-diffusion using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const output = await replicate.run(
"stability-ai/stable-diffusion:ac732df83cea7fff18b8472768c88ad041fa750ff7682a21affe81863cbe77e4",
{
input: {
width: 768,
height: 768,
prompt: "an astronaut riding a horse on mars, hd, dramatic lighting",
scheduler: "K_EULER",
num_outputs: 1,
guidance_scale: 7.5,
num_inference_steps: 50
}
}
);
console.log(output);
To learn more, take a look at the guide on getting started with Node.js.
pip install replicate
REPLICATE_API_TOKEN
environment variable:export REPLICATE_API_TOKEN=<paste-your-token-here>
Find your API token in your account settings.
import replicate
Run stability-ai/stable-diffusion using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"stability-ai/stable-diffusion:ac732df83cea7fff18b8472768c88ad041fa750ff7682a21affe81863cbe77e4",
input={
"width": 768,
"height": 768,
"prompt": "an astronaut riding a horse on mars, hd, dramatic lighting",
"scheduler": "K_EULER",
"num_outputs": 1,
"guidance_scale": 7.5,
"num_inference_steps": 50
}
)
print(output)
To learn more, take a look at the guide on getting started with Python.
REPLICATE_API_TOKEN
environment variable:export REPLICATE_API_TOKEN=<paste-your-token-here>
Find your API token in your account settings.
Run stability-ai/stable-diffusion using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
curl -s -X POST \
-H "Authorization: Bearer $REPLICATE_API_TOKEN" \
-H "Content-Type: application/json" \
-H "Prefer: wait" \
-d $'{
"version": "ac732df83cea7fff18b8472768c88ad041fa750ff7682a21affe81863cbe77e4",
"input": {
"width": 768,
"height": 768,
"prompt": "an astronaut riding a horse on mars, hd, dramatic lighting",
"scheduler": "K_EULER",
"num_outputs": 1,
"guidance_scale": 7.5,
"num_inference_steps": 50
}
}' \
https://api.replicate.com/v1/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
brew install cog
If you don’t have Homebrew, there are other installation options available.
Run this to download the model and run it in your local environment:
cog predict r8.im/stability-ai/stable-diffusion@sha256:ac732df83cea7fff18b8472768c88ad041fa750ff7682a21affe81863cbe77e4 \
-i 'width=768' \
-i 'height=768' \
-i 'prompt="an astronaut riding a horse on mars, hd, dramatic lighting"' \
-i 'scheduler="K_EULER"' \
-i 'num_outputs=1' \
-i 'guidance_scale=7.5' \
-i 'num_inference_steps=50'
To learn more, take a look at the Cog documentation.
Run this to download the model and run it in your local environment:
docker run -d -p 5000:5000 --gpus=all r8.im/stability-ai/stable-diffusion@sha256:ac732df83cea7fff18b8472768c88ad041fa750ff7682a21affe81863cbe77e4
curl -s -X POST \ -H "Content-Type: application/json" \ -d $'{ "input": { "width": 768, "height": 768, "prompt": "an astronaut riding a horse on mars, hd, dramatic lighting", "scheduler": "K_EULER", "num_outputs": 1, "guidance_scale": 7.5, "num_inference_steps": 50 } }' \ http://localhost:5000/predictions
To learn more, take a look at the Cog documentation.
Add a payment method to run this model.
Each run costs approximately $0.0035. Alternatively, try out our featured models for free.
By signing in, you agree to our
terms of service and privacy policy
Output
{
"completed_at": "2023-04-10T15:45:33.474978Z",
"created_at": "2023-04-10T15:45:31.434998Z",
"data_removed": false,
"error": null,
"id": "uvb7ynit4bhpjds3vn4bx7npeq",
"input": {
"prompt": "an astronaut riding a horse on mars, hd, dramatic lighting",
"scheduler": "K_EULER",
"num_outputs": 1,
"guidance_scale": 7.5,
"image_dimensions": "512x512",
"num_inference_steps": 50
},
"logs": "Using seed: 52443\ninput_shape: torch.Size([1, 77])\n 0%| | 0/50 [00:00<?, ?it/s]\n 10%|█ | 5/50 [00:00<00:01, 41.06it/s]\n 20%|██ | 10/50 [00:00<00:00, 41.32it/s]\n 30%|███ | 15/50 [00:00<00:00, 43.77it/s]\n 42%|████▏ | 21/50 [00:00<00:00, 46.80it/s]\n 54%|█████▍ | 27/50 [00:00<00:00, 48.53it/s]\n 66%|██████▌ | 33/50 [00:00<00:00, 49.63it/s]\n 78%|███████▊ | 39/50 [00:00<00:00, 50.45it/s]\n 90%|█████████ | 45/50 [00:00<00:00, 50.90it/s]\n100%|██████████| 50/50 [00:01<00:00, 48.51it/s]",
"metrics": {
"predict_time": 1.889956,
"total_time": 2.03998
},
"output": [
"https://replicate.delivery/pbxt/sWeZFZou6v3CPKuoJbqX46ugPaHT1DcsWYx0srPmGrMOCPYIA/out-0.png"
],
"started_at": "2023-04-10T15:45:31.585022Z",
"status": "succeeded",
"urls": {
"get": "https://api.replicate.com/v1/predictions/uvb7ynit4bhpjds3vn4bx7npeq",
"cancel": "https://api.replicate.com/v1/predictions/uvb7ynit4bhpjds3vn4bx7npeq/cancel"
},
"version": "db21e45d3f7023abc2a46ee38a23973f6dce16bb082a930b0c49861f96d1e5bf"
}
Using seed: 52443
input_shape: torch.Size([1, 77])
0%| | 0/50 [00:00<?, ?it/s]
10%|█ | 5/50 [00:00<00:01, 41.06it/s]
20%|██ | 10/50 [00:00<00:00, 41.32it/s]
30%|███ | 15/50 [00:00<00:00, 43.77it/s]
42%|████▏ | 21/50 [00:00<00:00, 46.80it/s]
54%|█████▍ | 27/50 [00:00<00:00, 48.53it/s]
66%|██████▌ | 33/50 [00:00<00:00, 49.63it/s]
78%|███████▊ | 39/50 [00:00<00:00, 50.45it/s]
90%|█████████ | 45/50 [00:00<00:00, 50.90it/s]
100%|██████████| 50/50 [00:01<00:00, 48.51it/s]
This example was created by a different version, stability-ai/stable-diffusion:db21e45d.