defaulta photo of an astronaut riding a horse on mars
typetext
{
"guidance_scale": 7.5,
"image": "https://replicate.delivery/pbxt/HtGQBfA5TrqFYZBf0UL18NTqHrzt8UiSIsAkUuMHtjvFDO6p/overture-creations-5sI6fQgYIuo.png",
"mask": "https://replicate.delivery/pbxt/HtGQBqO9MtVbPm0G0K43nsvvjBB0E0PaWOhuNRrRBBT4ttbf/mask.png",
"num_inference_steps": 25,
"num_outputs": 1,
"prompt": "Face of a yellow cat, high resolution, sitting on a park bench",
"prompt_strength": 0.8
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_PkN**********************************
This is your API token. Keep it to yourself.
import Replicate from "replicate";
import fs from "node:fs";
const replicate = new Replicate({
auth: process.env.REPLICATE_API_TOKEN,
});
Run stability-ai/stable-diffusion-inpainting 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-inpainting:e5a34f913de0adc560d20e002c45ad43a80031b62caacc3d84010c6b6a64870c",
{
input: {
guidance_scale: 7.5,
image: "https://replicate.delivery/pbxt/HtGQBfA5TrqFYZBf0UL18NTqHrzt8UiSIsAkUuMHtjvFDO6p/overture-creations-5sI6fQgYIuo.png",
mask: "https://replicate.delivery/pbxt/HtGQBqO9MtVbPm0G0K43nsvvjBB0E0PaWOhuNRrRBBT4ttbf/mask.png",
num_inference_steps: 25,
num_outputs: 1,
prompt: "Face of a yellow cat, high resolution, sitting on a park bench",
prompt_strength: 0.8
}
}
);
// 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
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_PkN**********************************
This is your API token. Keep it to yourself.
import replicate
Run stability-ai/stable-diffusion-inpainting using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"stability-ai/stable-diffusion-inpainting:e5a34f913de0adc560d20e002c45ad43a80031b62caacc3d84010c6b6a64870c",
input={
"guidance_scale": 7.5,
"image": "https://replicate.delivery/pbxt/HtGQBfA5TrqFYZBf0UL18NTqHrzt8UiSIsAkUuMHtjvFDO6p/overture-creations-5sI6fQgYIuo.png",
"mask": "https://replicate.delivery/pbxt/HtGQBqO9MtVbPm0G0K43nsvvjBB0E0PaWOhuNRrRBBT4ttbf/mask.png",
"num_inference_steps": 25,
"num_outputs": 1,
"prompt": "Face of a yellow cat, high resolution, sitting on a park bench",
"prompt_strength": 0.8
}
)
# To access the file URL:
print(output[0].url())
#=> "http://example.com"
# To write the file to disk:
with open("my-image.png", "wb") as file:
file.write(output[0].read())
To learn more, take a look at the guide on getting started with Python.
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_PkN**********************************
This is your API token. Keep it to yourself.
Run stability-ai/stable-diffusion-inpainting 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-inpainting:e5a34f913de0adc560d20e002c45ad43a80031b62caacc3d84010c6b6a64870c",
"input": {
"guidance_scale": 7.5,
"image": "https://replicate.delivery/pbxt/HtGQBfA5TrqFYZBf0UL18NTqHrzt8UiSIsAkUuMHtjvFDO6p/overture-creations-5sI6fQgYIuo.png",
"mask": "https://replicate.delivery/pbxt/HtGQBqO9MtVbPm0G0K43nsvvjBB0E0PaWOhuNRrRBBT4ttbf/mask.png",
"num_inference_steps": 25,
"num_outputs": 1,
"prompt": "Face of a yellow cat, high resolution, sitting on a park bench",
"prompt_strength": 0.8
}
}' \
https://api.replicate.com/v1/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
{
"id": "xkyxrm6j3jb3llitusuf4hycoa",
"model": "stability-ai/stable-diffusion-inpainting",
"version": "e5a34f913de0adc560d20e002c45ad43a80031b62caacc3d84010c6b6a64870c",
"input": {
"guidance_scale": 7.5,
"image": "https://replicate.delivery/pbxt/HtGQBfA5TrqFYZBf0UL18NTqHrzt8UiSIsAkUuMHtjvFDO6p/overture-creations-5sI6fQgYIuo.png",
"mask": "https://replicate.delivery/pbxt/HtGQBqO9MtVbPm0G0K43nsvvjBB0E0PaWOhuNRrRBBT4ttbf/mask.png",
"num_inference_steps": 25,
"num_outputs": 1,
"prompt": "Face of a yellow cat, high resolution, sitting on a park bench",
"prompt_strength": 0.8
},
"logs": "Using seed: 62372\n 0%| | 0/26 [00:00<?, ?it/s]\n 8%|▊ | 2/26 [00:00<00:01, 14.22it/s]\n 15%|█▌ | 4/26 [00:00<00:01, 15.62it/s]\n 23%|██▎ | 6/26 [00:00<00:01, 15.98it/s]\n 31%|███ | 8/26 [00:00<00:01, 16.07it/s]\n 38%|███▊ | 10/26 [00:00<00:00, 16.14it/s]\n 46%|████▌ | 12/26 [00:00<00:00, 16.29it/s]\n 54%|█████▍ | 14/26 [00:00<00:00, 16.39it/s]\n 62%|██████▏ | 16/26 [00:00<00:00, 16.40it/s]\n 69%|██████▉ | 18/26 [00:01<00:00, 16.42it/s]\n 77%|███████▋ | 20/26 [00:01<00:00, 16.49it/s]\n 85%|████████▍ | 22/26 [00:01<00:00, 16.31it/s]\n 92%|█████████▏| 24/26 [00:01<00:00, 16.37it/s]\n100%|██████████| 26/26 [00:01<00:00, 16.47it/s]\n100%|██████████| 26/26 [00:01<00:00, 16.26it/s]",
"output": [
"https://replicate.delivery/pbxt/xs0pPOUM6HKmPlJJBXqKfE1YsiMzgNsCuGedlX0VqvPYifLgA/out-0.png"
],
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2022-12-02T18:40:22.058556Z",
"started_at": "2022-12-02T18:40:22.094261Z",
"completed_at": "2022-12-02T18:40:24.80538Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/xkyxrm6j3jb3llitusuf4hycoa/cancel",
"get": "https://api.replicate.com/v1/predictions/xkyxrm6j3jb3llitusuf4hycoa"
},
"metrics": {
"predict_time": 2.711119,
"total_time": 2.746824
}
}

