defaultremove
typeenum
value typestring
optionsreplace, remove
{
"guidance_scale": 4,
"image": "https://replicate.delivery/pbxt/Ia2sH4mZsg448cYoYBspSFbg5MtdDXCSBmtbQJ1sUscw0rVl/2.jpg",
"mask_image": "https://replicate.delivery/pbxt/Ia2sGuBRcn7Va7fcHH1IapXZgguPWEOSoqjkM6B6NxziW2YV/2_mask.jpg",
"method": "replace",
"num_inference_steps": 40,
"num_outputs": 3,
"preview_input_image": true,
"prompt": "a Christmas tree",
"seed": 1234
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_Unq**********************************
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 anhappdev/test using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const output = await replicate.run(
"anhappdev/test:ef4e1e6402b90b4164caf1f8141e4994a7ae752e47cab0a452dc94039cec550a",
{
input: {
guidance_scale: 4,
image: "https://replicate.delivery/pbxt/Ia2sH4mZsg448cYoYBspSFbg5MtdDXCSBmtbQJ1sUscw0rVl/2.jpg",
mask_image: "https://replicate.delivery/pbxt/Ia2sGuBRcn7Va7fcHH1IapXZgguPWEOSoqjkM6B6NxziW2YV/2_mask.jpg",
method: "replace",
num_inference_steps: 40,
num_outputs: 3,
preview_input_image: true,
prompt: "a Christmas tree",
seed: 1234
}
}
);
// 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_Unq**********************************
This is your API token. Keep it to yourself.
import replicate
Run anhappdev/test using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"anhappdev/test:ef4e1e6402b90b4164caf1f8141e4994a7ae752e47cab0a452dc94039cec550a",
input={
"guidance_scale": 4,
"image": "https://replicate.delivery/pbxt/Ia2sH4mZsg448cYoYBspSFbg5MtdDXCSBmtbQJ1sUscw0rVl/2.jpg",
"mask_image": "https://replicate.delivery/pbxt/Ia2sGuBRcn7Va7fcHH1IapXZgguPWEOSoqjkM6B6NxziW2YV/2_mask.jpg",
"method": "replace",
"num_inference_steps": 40,
"num_outputs": 3,
"preview_input_image": True,
"prompt": "a Christmas tree",
"seed": 1234
}
)
# 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_Unq**********************************
This is your API token. Keep it to yourself.
Run anhappdev/test 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": "anhappdev/test:ef4e1e6402b90b4164caf1f8141e4994a7ae752e47cab0a452dc94039cec550a",
"input": {
"guidance_scale": 4,
"image": "https://replicate.delivery/pbxt/Ia2sH4mZsg448cYoYBspSFbg5MtdDXCSBmtbQJ1sUscw0rVl/2.jpg",
"mask_image": "https://replicate.delivery/pbxt/Ia2sGuBRcn7Va7fcHH1IapXZgguPWEOSoqjkM6B6NxziW2YV/2_mask.jpg",
"method": "replace",
"num_inference_steps": 40,
"num_outputs": 3,
"preview_input_image": true,
"prompt": "a Christmas tree",
"seed": 1234
}
}' \
https://api.replicate.com/v1/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
{
"id": "rkywf4latvc53pdu5lo6bn4kvq",
"model": "anhappdev/test",
"version": "ef4e1e6402b90b4164caf1f8141e4994a7ae752e47cab0a452dc94039cec550a",
"input": {
"guidance_scale": 4,
"image": "https://replicate.delivery/pbxt/Ia2sH4mZsg448cYoYBspSFbg5MtdDXCSBmtbQJ1sUscw0rVl/2.jpg",
"mask_image": "https://replicate.delivery/pbxt/Ia2sGuBRcn7Va7fcHH1IapXZgguPWEOSoqjkM6B6NxziW2YV/2_mask.jpg",
"method": "replace",
"num_inference_steps": 40,
"num_outputs": 3,
"preview_input_image": true,
"prompt": "a Christmas tree",
"seed": 1234
},
"logs": "2023-05-11 16:09:16,079 [INFO] :: Using seed: 1234\n 0%| | 0/40 [00:00<?, ?it/s]\n 5%|▌ | 2/40 [00:00<00:03, 11.82it/s]\n 10%|█ | 4/40 [00:00<00:03, 11.96it/s]\n 15%|█▌ | 6/40 [00:00<00:02, 12.74it/s]\n 20%|██ | 8/40 [00:00<00:02, 12.75it/s]\n 25%|██▌ | 10/40 [00:00<00:02, 12.87it/s]\n 30%|███ | 12/40 [00:00<00:02, 12.87it/s]\n 35%|███▌ | 14/40 [00:01<00:02, 12.89it/s]\n 40%|████ | 16/40 [00:01<00:01, 12.71it/s]\n 45%|████▌ | 18/40 [00:01<00:01, 12.93it/s]\n 50%|█████ | 20/40 [00:01<00:01, 12.79it/s]\n 55%|█████▌ | 22/40 [00:01<00:01, 12.76it/s]\n 60%|██████ | 24/40 [00:01<00:01, 13.21it/s]\n 65%|██████▌ | 26/40 [00:02<00:01, 13.55it/s]\n 70%|███████ | 28/40 [00:02<00:00, 13.40it/s]\n 75%|███████▌ | 30/40 [00:02<00:00, 13.20it/s]\n 80%|████████ | 32/40 [00:02<00:00, 13.07it/s]\n 85%|████████▌ | 34/40 [00:02<00:00, 12.82it/s]\n 90%|█████████ | 36/40 [00:02<00:00, 13.40it/s]\n 95%|█████████▌| 38/40 [00:02<00:00, 13.85it/s]\n100%|██████████| 40/40 [00:03<00:00, 14.02it/s]\n100%|██████████| 40/40 [00:03<00:00, 13.15it/s]",
"output": [
"https://replicate.delivery/pbxt/dwimchKBLOb8ORkAnRRAKDf59r8f7iflcX51NOKcB51rpY1hA/replace-masked-image.jpg",
"https://replicate.delivery/pbxt/0N3feGIm3efSORZXfGsAMlJ5b12WKSXs9RBNA859yGrxmiVHC/replace-out-0.jpg",
"https://replicate.delivery/pbxt/KeXIe0yxh1uwlkCHqQl4PsFX6YaqVBfw9dcYwLOUJO4spY1hA/replace-out-1.jpg",
"https://replicate.delivery/pbxt/LstIB3uC7QJyDNQfUnnMCpL0o0cYZkLGfbecCsJUe6cdTxqDB/replace-out-2.jpg"
],
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2023-05-11T16:09:15.192448Z",
"started_at": "2023-05-11T16:09:15.235806Z",
"completed_at": "2023-05-11T16:09:28.274747Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/rkywf4latvc53pdu5lo6bn4kvq/cancel",
"get": "https://api.replicate.com/v1/predictions/rkywf4latvc53pdu5lo6bn4kvq"
},
"metrics": {
"predict_time": 13.038941,
"total_time": 13.082299
}
}




