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:7f7d040c40f663a4dce135c3cb524f9b69ef394e72ee72b8e8e6a9a898206641",
{
input: {
seed: 12345,
image: "https://replicate.delivery/pbxt/Ia2E3MUrVDVXITRVSKCHcCYi9WMYGoTpqxtqZ0PuqRoaY3FW/1.jpg",
method: "adjust",
prompt: "a green leather couch",
mask_image: "https://replicate.delivery/pbxt/Ia2E2SDOE51oEfLeToezFAIYKw84oX0wHJYNVO5GUr6YMFMi/1_mask.jpg",
num_outputs: 4,
control_scale: 0.5,
guidance_scale: 8,
negative_prompt: "",
num_inference_steps: 30
}
}
);
// 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:7f7d040c40f663a4dce135c3cb524f9b69ef394e72ee72b8e8e6a9a898206641",
input={
"seed": 12345,
"image": "https://replicate.delivery/pbxt/Ia2E3MUrVDVXITRVSKCHcCYi9WMYGoTpqxtqZ0PuqRoaY3FW/1.jpg",
"method": "adjust",
"prompt": "a green leather couch",
"mask_image": "https://replicate.delivery/pbxt/Ia2E2SDOE51oEfLeToezFAIYKw84oX0wHJYNVO5GUr6YMFMi/1_mask.jpg",
"num_outputs": 4,
"control_scale": 0.5,
"guidance_scale": 8,
"negative_prompt": "",
"num_inference_steps": 30
}
)
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:7f7d040c40f663a4dce135c3cb524f9b69ef394e72ee72b8e8e6a9a898206641",
"input": {
"seed": 12345,
"image": "https://replicate.delivery/pbxt/Ia2E3MUrVDVXITRVSKCHcCYi9WMYGoTpqxtqZ0PuqRoaY3FW/1.jpg",
"method": "adjust",
"prompt": "a green leather couch",
"mask_image": "https://replicate.delivery/pbxt/Ia2E2SDOE51oEfLeToezFAIYKw84oX0wHJYNVO5GUr6YMFMi/1_mask.jpg",
"num_outputs": 4,
"control_scale": 0.5,
"guidance_scale": 8,
"negative_prompt": "",
"num_inference_steps": 30
}
}' \
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-04-30T09:08:18.740721Z",
"created_at": "2023-04-30T09:06:48.057578Z",
"data_removed": false,
"error": null,
"id": "pavvq3aqxfdcvpxnwus4vq746i",
"input": {
"seed": 12345,
"image": "https://replicate.delivery/pbxt/Ia2E3MUrVDVXITRVSKCHcCYi9WMYGoTpqxtqZ0PuqRoaY3FW/1.jpg",
"method": "adjust",
"prompt": "a green leather couch",
"mask_image": "https://replicate.delivery/pbxt/Ia2E2SDOE51oEfLeToezFAIYKw84oX0wHJYNVO5GUr6YMFMi/1_mask.jpg",
"num_outputs": 4,
"control_scale": 0.5,
"guidance_scale": 8,
"num_inference_steps": 30
},
"logs": "2023-04-30 09:07:12,255 [INFO] :: Using seed: 12345\n 0%| | 0/30 [00:00<?, ?it/s][2023-04-30 09:07:19,285] torch._dynamo.convert_frame: [WARNING] torch._dynamo hit config.cache_size_limit (64)\nfunction: 'forward' (/root/.pyenv/versions/3.9.16/lib/python3.9/site-packages/diffusers/models/attention_processor.py:263)\nreasons: tensor 'hidden_states' size mismatch at index 0. expected 6, actual 8\nto diagnose recompilation issues, see https://pytorch.org/docs/master/dynamo/troubleshooting.html.\n[2023-04-30 09:07:19,287] torch._dynamo.convert_frame: [WARNING] torch._dynamo hit config.cache_size_limit (64)\nfunction: '__call__' (/root/.pyenv/versions/3.9.16/lib/python3.9/site-packages/diffusers/models/attention_processor.py:714)\nreasons: tensor 'hidden_states' size mismatch at index 0. expected 6, actual 8\nto diagnose recompilation issues, see https://pytorch.org/docs/master/dynamo/troubleshooting.html.\n 3%|▎ | 1/30 [00:55<26:44, 55.31s/it]\n 7%|▋ | 2/30 [00:55<10:39, 22.85s/it]\n 10%|█ | 3/30 [00:55<05:36, 12.46s/it]\n 17%|█▋ | 5/30 [00:55<02:16, 5.46s/it]\n 20%|██ | 6/30 [00:55<01:34, 3.92s/it]\n 27%|██▋ | 8/30 [00:56<00:48, 2.20s/it]\n 33%|███▎ | 10/30 [00:56<00:27, 1.37s/it]\n 40%|████ | 12/30 [00:56<00:16, 1.09it/s]\n 47%|████▋ | 14/30 [00:56<00:10, 1.56it/s]\n 53%|█████▎ | 16/30 [00:56<00:06, 2.16it/s]\n 60%|██████ | 18/30 [00:57<00:04, 2.88it/s]\n 67%|██████▋ | 20/30 [00:57<00:02, 3.71it/s]\n 73%|███████▎ | 22/30 [00:57<00:01, 4.60it/s]\n 80%|████████ | 24/30 [00:57<00:01, 5.52it/s]\n 87%|████████▋ | 26/30 [00:57<00:00, 6.40it/s]\n 93%|█████████▎| 28/30 [00:58<00:00, 7.19it/s]\n100%|██████████| 30/30 [00:58<00:00, 7.88it/s]\n100%|██████████| 30/30 [00:58<00:00, 1.94s/it]",
"metrics": {
"predict_time": 67.429766,
"total_time": 90.683143
},
"output": [
"https://replicate.delivery/pbxt/CWZ1F8mEmUaPMFYTVKQNieLjKwCNL9ix5MCxqyYbTU3fHethA/adjust-out-0.jpg",
"https://replicate.delivery/pbxt/flNJ1u5Gbej7b0DfgXtMBKg8FJiizVyNQuZifPZ0v12Bg4bDB/adjust-out-1.jpg",
"https://replicate.delivery/pbxt/JM4NtBUneux9RqnGaW6N2MEHaQAuDcN3DuC7JDnopFrAEf2QA/adjust-out-2.jpg",
"https://replicate.delivery/pbxt/1fLY4ZJfguj0c0lTtQuW81dd0gql8Ee8S76G4uWu3EKEQ8thA/adjust-out-3.jpg"
],
"started_at": "2023-04-30T09:07:11.310955Z",
"status": "succeeded",
"urls": {
"get": "https://api.replicate.com/v1/predictions/pavvq3aqxfdcvpxnwus4vq746i",
"cancel": "https://api.replicate.com/v1/predictions/pavvq3aqxfdcvpxnwus4vq746i/cancel"
},
"version": "7f7d040c40f663a4dce135c3cb524f9b69ef394e72ee72b8e8e6a9a898206641"
}
2023-04-30 09:07:12,255 [INFO] :: Using seed: 12345
0%| | 0/30 [00:00<?, ?it/s][2023-04-30 09:07:19,285] torch._dynamo.convert_frame: [WARNING] torch._dynamo hit config.cache_size_limit (64)
function: 'forward' (/root/.pyenv/versions/3.9.16/lib/python3.9/site-packages/diffusers/models/attention_processor.py:263)
reasons: tensor 'hidden_states' size mismatch at index 0. expected 6, actual 8
to diagnose recompilation issues, see https://pytorch.org/docs/master/dynamo/troubleshooting.html.
[2023-04-30 09:07:19,287] torch._dynamo.convert_frame: [WARNING] torch._dynamo hit config.cache_size_limit (64)
function: '__call__' (/root/.pyenv/versions/3.9.16/lib/python3.9/site-packages/diffusers/models/attention_processor.py:714)
reasons: tensor 'hidden_states' size mismatch at index 0. expected 6, actual 8
to diagnose recompilation issues, see https://pytorch.org/docs/master/dynamo/troubleshooting.html.
3%|▎ | 1/30 [00:55<26:44, 55.31s/it]
7%|▋ | 2/30 [00:55<10:39, 22.85s/it]
10%|█ | 3/30 [00:55<05:36, 12.46s/it]
17%|█▋ | 5/30 [00:55<02:16, 5.46s/it]
20%|██ | 6/30 [00:55<01:34, 3.92s/it]
27%|██▋ | 8/30 [00:56<00:48, 2.20s/it]
33%|███▎ | 10/30 [00:56<00:27, 1.37s/it]
40%|████ | 12/30 [00:56<00:16, 1.09it/s]
47%|████▋ | 14/30 [00:56<00:10, 1.56it/s]
53%|█████▎ | 16/30 [00:56<00:06, 2.16it/s]
60%|██████ | 18/30 [00:57<00:04, 2.88it/s]
67%|██████▋ | 20/30 [00:57<00:02, 3.71it/s]
73%|███████▎ | 22/30 [00:57<00:01, 4.60it/s]
80%|████████ | 24/30 [00:57<00:01, 5.52it/s]
87%|████████▋ | 26/30 [00:57<00:00, 6.40it/s]
93%|█████████▎| 28/30 [00:58<00:00, 7.19it/s]
100%|██████████| 30/30 [00:58<00:00, 7.88it/s]
100%|██████████| 30/30 [00:58<00:00, 1.94s/it]