{
"prompt": "A red car parked in a desert | Hills behind the car | Aurora in the sky"
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_CiO**********************************
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 energy-based-model/compositional-vsual-generation-with-composable-diffusion-models-pytorch using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const output = await replicate.run(
"energy-based-model/compositional-vsual-generation-with-composable-diffusion-models-pytorch:fd76d2f66b0faf04184408ce21f02baf921df01d074308ba149a70fa6afc93dc",
{
input: {
prompt: "A red car parked in a desert | Hills behind the car | Aurora in the sky"
}
}
);
// To access the file URL:
console.log(output.url()); //=> "http://example.com"
// To write the file to disk:
fs.writeFile("my-image.png", output);
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_CiO**********************************
This is your API token. Keep it to yourself.
import replicate
Run energy-based-model/compositional-vsual-generation-with-composable-diffusion-models-pytorch using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"energy-based-model/compositional-vsual-generation-with-composable-diffusion-models-pytorch:fd76d2f66b0faf04184408ce21f02baf921df01d074308ba149a70fa6afc93dc",
input={
"prompt": "A red car parked in a desert | Hills behind the car | Aurora in the sky"
}
)
# To access the file URL:
print(output.url())
#=> "http://example.com"
# To write the file to disk:
with open("my-image.png", "wb") as file:
file.write(output.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_CiO**********************************
This is your API token. Keep it to yourself.
Run energy-based-model/compositional-vsual-generation-with-composable-diffusion-models-pytorch 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": "energy-based-model/compositional-vsual-generation-with-composable-diffusion-models-pytorch:fd76d2f66b0faf04184408ce21f02baf921df01d074308ba149a70fa6afc93dc",
"input": {
"prompt": "A red car parked in a desert | Hills behind the car | Aurora in the sky"
}
}' \
https://api.replicate.com/v1/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
{
"id": "cmzsiyxgqrgphisvsc5gjhnzy4",
"model": "energy-based-model/compositional-vsual-generation-with-composable-diffusion-models-pytorch",
"version": "fd76d2f66b0faf04184408ce21f02baf921df01d074308ba149a70fa6afc93dc",
"input": {
"prompt": "A red car parked in a desert | Hills behind the car | Aurora in the sky"
},
"logs": "\n 0%| | 0/100 [00:00<?, ?it/s]\n 1%| | 1/100 [00:00<00:20, 4.73it/s]\n 2%|▏ | 2/100 [00:00<00:18, 5.17it/s]\n 3%|▎ | 3/100 [00:00<00:17, 5.52it/s]\n 4%|▍ | 4/100 [00:00<00:16, 5.79it/s]\n 5%|▌ | 5/100 [00:00<00:15, 5.99it/s]\n 6%|▌ | 6/100 [00:00<00:15, 6.16it/s]\n 7%|▋ | 7/100 [00:01<00:14, 6.26it/s]\n 8%|▊ | 8/100 [00:01<00:14, 6.32it/s]\n 9%|▉ | 9/100 [00:01<00:14, 6.39it/s]\n 10%|█ | 10/100 [00:01<00:14, 6.43it/s]\n 11%|█ | 11/100 [00:01<00:13, 6.46it/s]\n 12%|█▏ | 12/100 [00:01<00:13, 6.45it/s]\n 13%|█▎ | 13/100 [00:02<00:13, 6.44it/s]\n 14%|█▍ | 14/100 [00:02<00:13, 6.47it/s]\n 15%|█▌ | 15/100 [00:02<00:13, 6.50it/s]\n 16%|█▌ | 16/100 [00:02<00:12, 6.52it/s]\n 17%|█▋ | 17/100 [00:02<00:12, 6.50it/s]\n 18%|█▊ | 18/100 [00:02<00:12, 6.49it/s]\n 19%|█▉ | 19/100 [00:02<00:12, 6.51it/s]\n 20%|██ | 20/100 [00:03<00:12, 6.49it/s]\n 21%|██ | 21/100 [00:03<00:12, 6.50it/s]\n 22%|██▏ | 22/100 [00:03<00:12, 6.49it/s]\n 23%|██▎ | 23/100 [00:03<00:11, 6.48it/s]\n 24%|██▍ | 24/100 [00:03<00:11, 6.49it/s]\n 25%|██▌ | 25/100 [00:03<00:11, 6.50it/s]\n 26%|██▌ | 26/100 [00:04<00:11, 6.51it/s]\n 27%|██▋ | 27/100 [00:04<00:11, 6.49it/s]\n 28%|██▊ | 28/100 [00:04<00:11, 6.46it/s]\n 29%|██▉ | 29/100 [00:04<00:11, 6.45it/s]\n 30%|███ | 30/100 [00:04<00:10, 6.41it/s]\n 31%|███ | 31/100 [00:04<00:10, 6.41it/s]\n 32%|███▏ | 32/100 [00:04<00:10, 6.45it/s]\n 33%|███▎ | 33/100 [00:05<00:10, 6.46it/s]\n 34%|███▍ | 34/100 [00:05<00:10, 6.52it/s]\n 35%|███▌ | 35/100 [00:05<00:10, 6.48it/s]\n 36%|███▌ | 36/100 [00:05<00:09, 6.47it/s]\n 37%|███▋ | 37/100 [00:05<00:09, 6.46it/s]\n 38%|███▊ | 38/100 [00:05<00:09, 6.43it/s]\n 39%|███▉ | 39/100 [00:06<00:09, 6.45it/s]\n 40%|████ | 40/100 [00:06<00:09, 6.44it/s]\n 41%|████ | 41/100 [00:06<00:09, 6.38it/s]\n 42%|████▏ | 42/100 [00:06<00:09, 6.41it/s]\n 43%|████▎ | 43/100 [00:06<00:08, 6.44it/s]\n 44%|████▍ | 44/100 [00:06<00:08, 6.44it/s]\n 45%|████▌ | 45/100 [00:07<00:08, 6.42it/s]\n 46%|████▌ | 46/100 [00:07<00:08, 6.42it/s]\n 47%|████▋ | 47/100 [00:07<00:08, 6.43it/s]\n 48%|████▊ | 48/100 [00:07<00:08, 6.45it/s]\n 49%|████▉ | 49/100 [00:07<00:07, 6.44it/s]\n 50%|█████ | 50/100 [00:07<00:07, 6.40it/s]\n 51%|█████ | 51/100 [00:07<00:07, 6.40it/s]\n 52%|█████▏ | 52/100 [00:08<00:07, 6.35it/s]\n 53%|█████▎ | 53/100 [00:08<00:07, 6.40it/s]\n 54%|█████▍ | 54/100 [00:08<00:07, 6.41it/s]\n 55%|█████▌ | 55/100 [00:08<00:07, 6.43it/s]\n 56%|█████▌ | 56/100 [00:08<00:06, 6.45it/s]\n 57%|█████▋ | 57/100 [00:08<00:06, 6.45it/s]\n 58%|█████▊ | 58/100 [00:09<00:06, 6.47it/s]\n 59%|█████▉ | 59/100 [00:09<00:06, 6.47it/s]\n 60%|██████ | 60/100 [00:09<00:06, 6.47it/s]\n 61%|██████ | 61/100 [00:09<00:06, 6.48it/s]\n 62%|██████▏ | 62/100 [00:09<00:05, 6.46it/s]\n 63%|██████▎ | 63/100 [00:09<00:05, 6.44it/s]\n 64%|██████▍ | 64/100 [00:09<00:05, 6.46it/s]\n 65%|██████▌ | 65/100 [00:10<00:05, 6.44it/s]\n 66%|██████▌ | 66/100 [00:10<00:05, 6.44it/s]\n 67%|██████▋ | 67/100 [00:10<00:05, 6.46it/s]\n 68%|██████▊ | 68/100 [00:10<00:04, 6.43it/s]\n 69%|██████▉ | 69/100 [00:10<00:04, 6.43it/s]\n 70%|███████ | 70/100 [00:10<00:04, 6.43it/s]\n 71%|███████ | 71/100 [00:11<00:04, 6.42it/s]\n 72%|███████▏ | 72/100 [00:11<00:04, 6.44it/s]\n 73%|███████▎ | 73/100 [00:11<00:04, 6.44it/s]\n 74%|███████▍ | 74/100 [00:11<00:04, 6.43it/s]\n 75%|███████▌ | 75/100 [00:11<00:03, 6.42it/s]\n 76%|███████▌ | 76/100 [00:11<00:03, 6.40it/s]\n 77%|███████▋ | 77/100 [00:11<00:03, 6.42it/s]\n 78%|███████▊ | 78/100 [00:12<00:03, 6.42it/s]\n 79%|███████▉ | 79/100 [00:12<00:03, 6.44it/s]\n 80%|████████ | 80/100 [00:12<00:03, 6.44it/s]\n 81%|████████ | 81/100 [00:12<00:02, 6.42it/s]\n 82%|████████▏ | 82/100 [00:12<00:02, 6.43it/s]\n 83%|████████▎ | 83/100 [00:12<00:02, 6.43it/s]\n 84%|████████▍ | 84/100 [00:13<00:02, 6.43it/s]\n 85%|████████▌ | 85/100 [00:13<00:02, 6.45it/s]\n 86%|████████▌ | 86/100 [00:13<00:02, 6.44it/s]\n 87%|████████▋ | 87/100 [00:13<00:02, 6.45it/s]\n 88%|████████▊ | 88/100 [00:13<00:01, 6.44it/s]\n 89%|████████▉ | 89/100 [00:13<00:01, 6.44it/s]\n 90%|█████████ | 90/100 [00:13<00:01, 6.44it/s]\n 91%|█████████ | 91/100 [00:14<00:01, 6.44it/s]\n 92%|█████████▏| 92/100 [00:14<00:01, 6.44it/s]\n 93%|█████████▎| 93/100 [00:14<00:01, 6.42it/s]\n 94%|█████████▍| 94/100 [00:14<00:00, 6.43it/s]\n 95%|█████████▌| 95/100 [00:14<00:00, 6.42it/s]\n 96%|█████████▌| 96/100 [00:14<00:00, 6.38it/s]\n 97%|█████████▋| 97/100 [00:15<00:00, 6.36it/s]\n 98%|█████████▊| 98/100 [00:15<00:00, 6.36it/s]\n 99%|█████████▉| 99/100 [00:15<00:00, 6.38it/s]\n100%|██████████| 100/100 [00:15<00:00, 6.40it/s]\n100%|██████████| 100/100 [00:15<00:00, 6.43it/s]\n\n 0%| | 0/27 [00:00<?, ?it/s]\n 4%|▎ | 1/27 [00:00<00:04, 5.36it/s]\n 7%|▋ | 2/27 [00:00<00:04, 5.36it/s]\n 11%|█ | 3/27 [00:00<00:04, 5.35it/s]\n 15%|█▍ | 4/27 [00:00<00:04, 5.36it/s]\n 19%|█▊ | 5/27 [00:00<00:04, 5.34it/s]\n 22%|██▏ | 6/27 [00:01<00:03, 5.32it/s]\n 26%|██▌ | 7/27 [00:01<00:03, 5.33it/s]\n 30%|██▉ | 8/27 [00:01<00:03, 5.35it/s]\n 33%|███▎ | 9/27 [00:01<00:03, 5.36it/s]\n 37%|███▋ | 10/27 [00:01<00:03, 5.35it/s]\n 41%|████ | 11/27 [00:02<00:03, 5.31it/s]\n 44%|████▍ | 12/27 [00:02<00:02, 5.31it/s]\n 48%|████▊ | 13/27 [00:02<00:02, 5.32it/s]\n 52%|█████▏ | 14/27 [00:02<00:02, 5.31it/s]\n 56%|█████▌ | 15/27 [00:02<00:02, 5.30it/s]\n 59%|█████▉ | 16/27 [00:03<00:02, 5.30it/s]\n 63%|██████▎ | 17/27 [00:03<00:01, 5.29it/s]\n 67%|██████▋ | 18/27 [00:03<00:01, 5.32it/s]\n 70%|███████ | 19/27 [00:03<00:01, 5.33it/s]\n 74%|███████▍ | 20/27 [00:03<00:01, 5.32it/s]\n 78%|███████▊ | 21/27 [00:03<00:01, 5.31it/s]\n 81%|████████▏ | 22/27 [00:04<00:00, 5.31it/s]\n 85%|████████▌ | 23/27 [00:04<00:00, 5.31it/s]\n 89%|████████▉ | 24/27 [00:04<00:00, 5.32it/s]\n 93%|█████████▎| 25/27 [00:04<00:00, 5.33it/s]\n 96%|█████████▋| 26/27 [00:04<00:00, 5.33it/s]\n100%|██████████| 27/27 [00:05<00:00, 5.33it/s]\n100%|██████████| 27/27 [00:05<00:00, 5.32it/s]",
"output": "https://replicate.delivery/mgxm/8525b32b-4a59-4865-a2ca-d2487ffa7221/output.png",
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2022-06-08T14:42:11.125442Z",
"started_at": "2022-06-08T14:42:11.426308Z",
"completed_at": "2022-06-08T14:42:32.524965Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/cmzsiyxgqrgphisvsc5gjhnzy4/cancel",
"get": "https://api.replicate.com/v1/predictions/cmzsiyxgqrgphisvsc5gjhnzy4"
},
"metrics": {
"predict_time": 21.098657,
"total_time": 21.399523
}
}