stability-ai / stable-diffusion-img2img
Generate a new image from an input image with Stable Diffusion
Want to make some of these yourself?
Run this modelGenerate a new image from an input image with Stable Diffusion
{
"image": "https://replicate.delivery/pbxt/HtKMvJSvuGWDn2B35mM396QGzcrgCNkcgSko8JxtXux4aX9H/sketch-mountains-input.jpeg",
"width": 512,
"height": 512,
"prompt": "A fantasy landscape, trending on artstation",
"scheduler": "DPMSolverMultistep",
"num_outputs": 1,
"guidance_scale": 7.5,
"prompt_strength": 0.8,
"num_inference_steps": "25"
}
npm install replicate
import Replicate from "replicate";
const replicate = new Replicate({
auth: process.env.REPLICATE_API_TOKEN,
});
Run stability-ai/stable-diffusion-img2img 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-img2img:ddd4eb440853a42c055203289a3da0c8886b0b9492fe619b1c1dbd34be160ce7",
{
input: {
image: "https://replicate.delivery/pbxt/HtKMvJSvuGWDn2B35mM396QGzcrgCNkcgSko8JxtXux4aX9H/sketch-mountains-input.jpeg",
width: 512,
height: 512,
prompt: "A fantasy landscape, trending on artstation",
scheduler: "DPMSolverMultistep",
num_outputs: 1,
guidance_scale: 7.5,
prompt_strength: 0.8,
num_inference_steps: "25"
}
}
);
// To access the file URL:
console.log(output[0].url()); //=> "http://example.com"
// To write the file to disk:
fs.writeFile("my-image.png", output[0]);
To learn more, take a look at the guide on getting started with Node.js.
pip install replicate
import replicate
Run stability-ai/stable-diffusion-img2img using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"stability-ai/stable-diffusion-img2img:ddd4eb440853a42c055203289a3da0c8886b0b9492fe619b1c1dbd34be160ce7",
input={
"image": "https://replicate.delivery/pbxt/HtKMvJSvuGWDn2B35mM396QGzcrgCNkcgSko8JxtXux4aX9H/sketch-mountains-input.jpeg",
"width": 512,
"height": 512,
"prompt": "A fantasy landscape, trending on artstation",
"scheduler": "DPMSolverMultistep",
"num_outputs": 1,
"guidance_scale": 7.5,
"prompt_strength": 0.8,
"num_inference_steps": "25"
}
)
print(output)
To learn more, take a look at the guide on getting started with Python.
Run stability-ai/stable-diffusion-img2img 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": "stability-ai/stable-diffusion-img2img:ddd4eb440853a42c055203289a3da0c8886b0b9492fe619b1c1dbd34be160ce7",
"input": {
"image": "https://replicate.delivery/pbxt/HtKMvJSvuGWDn2B35mM396QGzcrgCNkcgSko8JxtXux4aX9H/sketch-mountains-input.jpeg",
"width": 512,
"height": 512,
"prompt": "A fantasy landscape, trending on artstation",
"scheduler": "DPMSolverMultistep",
"num_outputs": 1,
"guidance_scale": 7.5,
"prompt_strength": 0.8,
"num_inference_steps": "25"
}
}' \
https://api.replicate.com/v1/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
{
"completed_at": "2022-12-02T22:58:41.057001Z",
"created_at": "2022-12-02T22:58:37.527127Z",
"data_removed": false,
"error": null,
"id": "m2yxuhgatfe73fvwyhcijgjera",
"input": {
"image": "https://replicate.delivery/pbxt/HtKMvJSvuGWDn2B35mM396QGzcrgCNkcgSko8JxtXux4aX9H/sketch-mountains-input.jpeg",
"width": 512,
"height": 512,
"prompt": "A fantasy landscape, trending on artstation",
"scheduler": "DPMSolverMultistep",
"num_outputs": 1,
"guidance_scale": 7.5,
"prompt_strength": 0.8,
"num_inference_steps": "25"
},
"logs": "Using seed: 53915\n 0%| | 0/20 [00:00<?, ?it/s]\n 5%|▌ | 1/20 [00:00<00:02, 8.32it/s]\n 10%|█ | 2/20 [00:00<00:01, 9.21it/s]\n 20%|██ | 4/20 [00:00<00:01, 10.05it/s]\n 30%|███ | 6/20 [00:00<00:01, 10.31it/s]\n 40%|████ | 8/20 [00:00<00:01, 10.43it/s]\n 50%|█████ | 10/20 [00:00<00:00, 10.50it/s]\n 60%|██████ | 12/20 [00:01<00:00, 10.53it/s]\n 70%|███████ | 14/20 [00:01<00:00, 10.56it/s]\n 80%|████████ | 16/20 [00:01<00:00, 10.58it/s]\n 90%|█████████ | 18/20 [00:01<00:00, 10.59it/s]\n100%|██████████| 20/20 [00:01<00:00, 10.59it/s]\n100%|██████████| 20/20 [00:01<00:00, 10.43it/s]",
"metrics": {
"predict_time": 3.495285,
"total_time": 3.529874
},
"output": [
"https://replicate.delivery/pbxt/ql3ndbIRkiZrChA31NxWt7kHMw9GM61lTrrqTIQcgtBI1gBE/out-0.png"
],
"started_at": "2022-12-02T22:58:37.561716Z",
"status": "succeeded",
"urls": {
"get": "https://api.replicate.com/v1/predictions/m2yxuhgatfe73fvwyhcijgjera",
"cancel": "https://api.replicate.com/v1/predictions/m2yxuhgatfe73fvwyhcijgjera/cancel"
},
"version": "ddd4eb440853a42c055203289a3da0c8886b0b9492fe619b1c1dbd34be160ce7"
}
Using seed: 53915
0%| | 0/20 [00:00<?, ?it/s]
5%|▌ | 1/20 [00:00<00:02, 8.32it/s]
10%|█ | 2/20 [00:00<00:01, 9.21it/s]
20%|██ | 4/20 [00:00<00:01, 10.05it/s]
30%|███ | 6/20 [00:00<00:01, 10.31it/s]
40%|████ | 8/20 [00:00<00:01, 10.43it/s]
50%|█████ | 10/20 [00:00<00:00, 10.50it/s]
60%|██████ | 12/20 [00:01<00:00, 10.53it/s]
70%|███████ | 14/20 [00:01<00:00, 10.56it/s]
80%|████████ | 16/20 [00:01<00:00, 10.58it/s]
90%|█████████ | 18/20 [00:01<00:00, 10.59it/s]
100%|██████████| 20/20 [00:01<00:00, 10.59it/s]
100%|██████████| 20/20 [00:01<00:00, 10.43it/s]
{
"image": "https://replicate.delivery/pbxt/HtKMvJSvuGWDn2B35mM396QGzcrgCNkcgSko8JxtXux4aX9H/sketch-mountains-input.jpeg",
"width": 512,
"height": 512,
"prompt": "A fantasy landscape, trending on artstation",
"scheduler": "K_EULER_ANCESTRAL",
"num_outputs": 1,
"guidance_scale": 7.5,
"prompt_strength": 0.8,
"num_inference_steps": "25"
}
npm install replicate
import Replicate from "replicate";
const replicate = new Replicate({
auth: process.env.REPLICATE_API_TOKEN,
});
Run stability-ai/stable-diffusion-img2img 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-img2img:9a9b6aa5ac2793993aaaff48fd0e05fc5be213bc85a0bafd24e578d3bb81e628",
{
input: {
image: "https://replicate.delivery/pbxt/HtKMvJSvuGWDn2B35mM396QGzcrgCNkcgSko8JxtXux4aX9H/sketch-mountains-input.jpeg",
width: 512,
height: 512,
prompt: "A fantasy landscape, trending on artstation",
scheduler: "K_EULER_ANCESTRAL",
num_outputs: 1,
guidance_scale: 7.5,
prompt_strength: 0.8,
num_inference_steps: "25"
}
}
);
// To access the file URL:
console.log(output[0].url()); //=> "http://example.com"
// To write the file to disk:
fs.writeFile("my-image.png", output[0]);
To learn more, take a look at the guide on getting started with Node.js.
pip install replicate
import replicate
Run stability-ai/stable-diffusion-img2img using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"stability-ai/stable-diffusion-img2img:9a9b6aa5ac2793993aaaff48fd0e05fc5be213bc85a0bafd24e578d3bb81e628",
input={
"image": "https://replicate.delivery/pbxt/HtKMvJSvuGWDn2B35mM396QGzcrgCNkcgSko8JxtXux4aX9H/sketch-mountains-input.jpeg",
"width": 512,
"height": 512,
"prompt": "A fantasy landscape, trending on artstation",
"scheduler": "K_EULER_ANCESTRAL",
"num_outputs": 1,
"guidance_scale": 7.5,
"prompt_strength": 0.8,
"num_inference_steps": "25"
}
)
print(output)
To learn more, take a look at the guide on getting started with Python.
Run stability-ai/stable-diffusion-img2img 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": "stability-ai/stable-diffusion-img2img:9a9b6aa5ac2793993aaaff48fd0e05fc5be213bc85a0bafd24e578d3bb81e628",
"input": {
"image": "https://replicate.delivery/pbxt/HtKMvJSvuGWDn2B35mM396QGzcrgCNkcgSko8JxtXux4aX9H/sketch-mountains-input.jpeg",
"width": 512,
"height": 512,
"prompt": "A fantasy landscape, trending on artstation",
"scheduler": "K_EULER_ANCESTRAL",
"num_outputs": 1,
"guidance_scale": 7.5,
"prompt_strength": 0.8,
"num_inference_steps": "25"
}
}' \
https://api.replicate.com/v1/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
{
"completed_at": "2022-12-03T00:14:26.914917Z",
"created_at": "2022-12-03T00:08:54.911903Z",
"data_removed": false,
"error": null,
"id": "qddjw5nx4jg27ocmusjrxtejs4",
"input": {
"image": "https://replicate.delivery/pbxt/HtKMvJSvuGWDn2B35mM396QGzcrgCNkcgSko8JxtXux4aX9H/sketch-mountains-input.jpeg",
"width": 512,
"height": 512,
"prompt": "A fantasy landscape, trending on artstation",
"scheduler": "K_EULER_ANCESTRAL",
"num_outputs": 1,
"guidance_scale": 7.5,
"prompt_strength": 0.8,
"num_inference_steps": "25"
},
"logs": "Using seed: 9445\n 0%| | 0/20 [00:00<?, ?it/s]\n 5%|▌ | 1/20 [00:00<00:03, 5.53it/s]\n 10%|█ | 2/20 [00:00<00:02, 6.84it/s]\n 15%|█▌ | 3/20 [00:00<00:02, 7.40it/s]\n 20%|██ | 4/20 [00:00<00:02, 7.70it/s]\n 25%|██▌ | 5/20 [00:00<00:01, 7.88it/s]\n 30%|███ | 6/20 [00:00<00:01, 7.99it/s]\n 35%|███▌ | 7/20 [00:00<00:01, 8.07it/s]\n 40%|████ | 8/20 [00:01<00:01, 8.12it/s]\n 45%|████▌ | 9/20 [00:01<00:01, 8.16it/s]\n 50%|█████ | 10/20 [00:01<00:01, 8.18it/s]\n 55%|█████▌ | 11/20 [00:01<00:01, 8.19it/s]\n 60%|██████ | 12/20 [00:01<00:00, 8.20it/s]\n 65%|██████▌ | 13/20 [00:01<00:00, 8.21it/s]\n 70%|███████ | 14/20 [00:01<00:00, 8.19it/s]\n 75%|███████▌ | 15/20 [00:01<00:00, 8.20it/s]\n 80%|████████ | 16/20 [00:02<00:00, 8.20it/s]\n 85%|████████▌ | 17/20 [00:02<00:00, 8.20it/s]\n 90%|█████████ | 18/20 [00:02<00:00, 8.20it/s]\n 95%|█████████▌| 19/20 [00:02<00:00, 8.20it/s]\n100%|██████████| 20/20 [00:02<00:00, 8.20it/s]\n100%|██████████| 20/20 [00:02<00:00, 8.02it/s]",
"metrics": {
"predict_time": 5.559297,
"total_time": 332.003014
},
"output": [
"https://replicate.delivery/pbxt/4vMrIQLDhRLnOt8PMiAPdKuePh8KZ6RmLjW8FyR6feeLuRYAB/out-0.png"
],
"started_at": "2022-12-03T00:14:21.355620Z",
"status": "succeeded",
"urls": {
"get": "https://api.replicate.com/v1/predictions/qddjw5nx4jg27ocmusjrxtejs4",
"cancel": "https://api.replicate.com/v1/predictions/qddjw5nx4jg27ocmusjrxtejs4/cancel"
},
"version": "9a9b6aa5ac2793993aaaff48fd0e05fc5be213bc85a0bafd24e578d3bb81e628"
}
Using seed: 9445
0%| | 0/20 [00:00<?, ?it/s]
5%|▌ | 1/20 [00:00<00:03, 5.53it/s]
10%|█ | 2/20 [00:00<00:02, 6.84it/s]
15%|█▌ | 3/20 [00:00<00:02, 7.40it/s]
20%|██ | 4/20 [00:00<00:02, 7.70it/s]
25%|██▌ | 5/20 [00:00<00:01, 7.88it/s]
30%|███ | 6/20 [00:00<00:01, 7.99it/s]
35%|███▌ | 7/20 [00:00<00:01, 8.07it/s]
40%|████ | 8/20 [00:01<00:01, 8.12it/s]
45%|████▌ | 9/20 [00:01<00:01, 8.16it/s]
50%|█████ | 10/20 [00:01<00:01, 8.18it/s]
55%|█████▌ | 11/20 [00:01<00:01, 8.19it/s]
60%|██████ | 12/20 [00:01<00:00, 8.20it/s]
65%|██████▌ | 13/20 [00:01<00:00, 8.21it/s]
70%|███████ | 14/20 [00:01<00:00, 8.19it/s]
75%|███████▌ | 15/20 [00:01<00:00, 8.20it/s]
80%|████████ | 16/20 [00:02<00:00, 8.20it/s]
85%|████████▌ | 17/20 [00:02<00:00, 8.20it/s]
90%|█████████ | 18/20 [00:02<00:00, 8.20it/s]
95%|█████████▌| 19/20 [00:02<00:00, 8.20it/s]
100%|██████████| 20/20 [00:02<00:00, 8.20it/s]
100%|██████████| 20/20 [00:02<00:00, 8.02it/s]
Want to make some of these yourself?
Run this modelThis model is cold. You'll get a fast response if the model is warm and already running, and a slower response if the model is cold and starting up.
Using seed: 53915
0%| | 0/20 [00:00<?, ?it/s]
5%|▌ | 1/20 [00:00<00:02, 8.32it/s]
10%|█ | 2/20 [00:00<00:01, 9.21it/s]
20%|██ | 4/20 [00:00<00:01, 10.05it/s]
30%|███ | 6/20 [00:00<00:01, 10.31it/s]
40%|████ | 8/20 [00:00<00:01, 10.43it/s]
50%|█████ | 10/20 [00:00<00:00, 10.50it/s]
60%|██████ | 12/20 [00:01<00:00, 10.53it/s]
70%|███████ | 14/20 [00:01<00:00, 10.56it/s]
80%|████████ | 16/20 [00:01<00:00, 10.58it/s]
90%|█████████ | 18/20 [00:01<00:00, 10.59it/s]
100%|██████████| 20/20 [00:01<00:00, 10.59it/s]
100%|██████████| 20/20 [00:01<00:00, 10.43it/s]
Using seed: 9445
0%| | 0/20 [00:00<?, ?it/s]
5%|▌ | 1/20 [00:00<00:03, 5.53it/s]
10%|█ | 2/20 [00:00<00:02, 6.84it/s]
15%|█▌ | 3/20 [00:00<00:02, 7.40it/s]
20%|██ | 4/20 [00:00<00:02, 7.70it/s]
25%|██▌ | 5/20 [00:00<00:01, 7.88it/s]
30%|███ | 6/20 [00:00<00:01, 7.99it/s]
35%|███▌ | 7/20 [00:00<00:01, 8.07it/s]
40%|████ | 8/20 [00:01<00:01, 8.12it/s]
45%|████▌ | 9/20 [00:01<00:01, 8.16it/s]
50%|█████ | 10/20 [00:01<00:01, 8.18it/s]
55%|█████▌ | 11/20 [00:01<00:01, 8.19it/s]
60%|██████ | 12/20 [00:01<00:00, 8.20it/s]
65%|██████▌ | 13/20 [00:01<00:00, 8.21it/s]
70%|███████ | 14/20 [00:01<00:00, 8.19it/s]
75%|███████▌ | 15/20 [00:01<00:00, 8.20it/s]
80%|████████ | 16/20 [00:02<00:00, 8.20it/s]
85%|████████▌ | 17/20 [00:02<00:00, 8.20it/s]
90%|█████████ | 18/20 [00:02<00:00, 8.20it/s]
95%|█████████▌| 19/20 [00:02<00:00, 8.20it/s]
100%|██████████| 20/20 [00:02<00:00, 8.20it/s]
100%|██████████| 20/20 [00:02<00:00, 8.02it/s]