Failed to load versions. Head to the versions page to see all versions for this model.
You're looking at a specific version of this model. Jump to the model overview.
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";
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: {
seed: 1234,
image: "https://replicate.delivery/pbxt/Ia2sH4mZsg448cYoYBspSFbg5MtdDXCSBmtbQJ1sUscw0rVl/2.jpg",
method: "replace",
prompt: "a Christmas tree",
mask_image: "https://replicate.delivery/pbxt/Ia2sGuBRcn7Va7fcHH1IapXZgguPWEOSoqjkM6B6NxziW2YV/2_mask.jpg",
num_outputs: 3,
guidance_scale: 4,
negative_prompt: "",
num_inference_steps: 40,
preview_input_image: true
}
}
);
// 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=<paste-your-token-here>
Find your API token in your account settings.
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={
"seed": 1234,
"image": "https://replicate.delivery/pbxt/Ia2sH4mZsg448cYoYBspSFbg5MtdDXCSBmtbQJ1sUscw0rVl/2.jpg",
"method": "replace",
"prompt": "a Christmas tree",
"mask_image": "https://replicate.delivery/pbxt/Ia2sGuBRcn7Va7fcHH1IapXZgguPWEOSoqjkM6B6NxziW2YV/2_mask.jpg",
"num_outputs": 3,
"guidance_scale": 4,
"negative_prompt": "",
"num_inference_steps": 40,
"preview_input_image": True
}
)
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 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": {
"seed": 1234,
"image": "https://replicate.delivery/pbxt/Ia2sH4mZsg448cYoYBspSFbg5MtdDXCSBmtbQJ1sUscw0rVl/2.jpg",
"method": "replace",
"prompt": "a Christmas tree",
"mask_image": "https://replicate.delivery/pbxt/Ia2sGuBRcn7Va7fcHH1IapXZgguPWEOSoqjkM6B6NxziW2YV/2_mask.jpg",
"num_outputs": 3,
"guidance_scale": 4,
"negative_prompt": "",
"num_inference_steps": 40,
"preview_input_image": true
}
}' \
https://api.replicate.com/v1/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
Add a payment method to run this model.
By signing in, you agree to our
terms of service and privacy policy
Output
{
"completed_at": "2023-05-11T16:09:28.274747Z",
"created_at": "2023-05-11T16:09:15.192448Z",
"data_removed": false,
"error": null,
"id": "rkywf4latvc53pdu5lo6bn4kvq",
"input": {
"seed": 1234,
"image": "https://replicate.delivery/pbxt/Ia2sH4mZsg448cYoYBspSFbg5MtdDXCSBmtbQJ1sUscw0rVl/2.jpg",
"method": "replace",
"prompt": "a Christmas tree",
"mask_image": "https://replicate.delivery/pbxt/Ia2sGuBRcn7Va7fcHH1IapXZgguPWEOSoqjkM6B6NxziW2YV/2_mask.jpg",
"num_outputs": 3,
"guidance_scale": 4,
"num_inference_steps": 40,
"preview_input_image": true
},
"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]",
"metrics": {
"predict_time": 13.038941,
"total_time": 13.082299
},
"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"
],
"started_at": "2023-05-11T16:09:15.235806Z",
"status": "succeeded",
"urls": {
"get": "https://api.replicate.com/v1/predictions/rkywf4latvc53pdu5lo6bn4kvq",
"cancel": "https://api.replicate.com/v1/predictions/rkywf4latvc53pdu5lo6bn4kvq/cancel"
},
"version": "ef4e1e6402b90b4164caf1f8141e4994a7ae752e47cab0a452dc94039cec550a"
}
2023-05-11 16:09:16,079 [INFO] :: Using seed: 1234
0%| | 0/40 [00:00<?, ?it/s]
5%|▌ | 2/40 [00:00<00:03, 11.82it/s]
10%|█ | 4/40 [00:00<00:03, 11.96it/s]
15%|█▌ | 6/40 [00:00<00:02, 12.74it/s]
20%|██ | 8/40 [00:00<00:02, 12.75it/s]
25%|██▌ | 10/40 [00:00<00:02, 12.87it/s]
30%|███ | 12/40 [00:00<00:02, 12.87it/s]
35%|███▌ | 14/40 [00:01<00:02, 12.89it/s]
40%|████ | 16/40 [00:01<00:01, 12.71it/s]
45%|████▌ | 18/40 [00:01<00:01, 12.93it/s]
50%|█████ | 20/40 [00:01<00:01, 12.79it/s]
55%|█████▌ | 22/40 [00:01<00:01, 12.76it/s]
60%|██████ | 24/40 [00:01<00:01, 13.21it/s]
65%|██████▌ | 26/40 [00:02<00:01, 13.55it/s]
70%|███████ | 28/40 [00:02<00:00, 13.40it/s]
75%|███████▌ | 30/40 [00:02<00:00, 13.20it/s]
80%|████████ | 32/40 [00:02<00:00, 13.07it/s]
85%|████████▌ | 34/40 [00:02<00:00, 12.82it/s]
90%|█████████ | 36/40 [00:02<00:00, 13.40it/s]
95%|█████████▌| 38/40 [00:02<00:00, 13.85it/s]
100%|██████████| 40/40 [00:03<00:00, 14.02it/s]
100%|██████████| 40/40 [00:03<00:00, 13.15it/s]