typetext
{
"batch_size": 4,
"batches": 1,
"height": 256,
"plms": false,
"prompt": "A beautiful view of a fantasy kingdom",
"scale": 5,
"steps": 100,
"width": 256
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_ALJ**********************************
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 nicholascelestin/latent-diffusion using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const output = await replicate.run(
"nicholascelestin/latent-diffusion:25cf1f58250f98328ffb225e7eccadcedcb72bb1ab26e463e9fa0fd8a05533df",
{
input: {
batch_size: 4,
batches: 1,
height: 256,
plms: false,
prompt: "A beautiful view of a fantasy kingdom",
scale: 5,
steps: 100,
width: 256
}
}
);
// 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_ALJ**********************************
This is your API token. Keep it to yourself.
import replicate
Run nicholascelestin/latent-diffusion using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"nicholascelestin/latent-diffusion:25cf1f58250f98328ffb225e7eccadcedcb72bb1ab26e463e9fa0fd8a05533df",
input={
"batch_size": 4,
"batches": 1,
"height": 256,
"plms": False,
"prompt": "A beautiful view of a fantasy kingdom",
"scale": 5,
"steps": 100,
"width": 256
}
)
# 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_ALJ**********************************
This is your API token. Keep it to yourself.
Run nicholascelestin/latent-diffusion 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": "nicholascelestin/latent-diffusion:25cf1f58250f98328ffb225e7eccadcedcb72bb1ab26e463e9fa0fd8a05533df",
"input": {
"batch_size": 4,
"batches": 1,
"height": 256,
"plms": false,
"prompt": "A beautiful view of a fantasy kingdom",
"scale": 5,
"steps": 100,
"width": 256
}
}' \
https://api.replicate.com/v1/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
{
"id": "spi4ffj46baktckvxrgs2nucbq",
"model": "nicholascelestin/latent-diffusion",
"version": "25cf1f58250f98328ffb225e7eccadcedcb72bb1ab26e463e9fa0fd8a05533df",
"input": {
"batch_size": 4,
"batches": 1,
"height": 256,
"plms": false,
"prompt": "A beautiful view of a fantasy kingdom",
"scale": 5,
"steps": 100,
"width": 256
},
"logs": "Prediction started!\nSampler loaded\n\nData shape for DDIM sampling is (4, 4, 32, 32), eta 0\nRunning DDIM Sampling with 100 timesteps\nSampling: 0%| | 0/1 [00:00<?, ?it/s]\n\nDDIM Sampler: 0%| | 0/100 [00:00<?, ?it/s]\u001b[A\n\nDDIM Sampler: 1%| | 1/100 [00:00<00:52, 1.87it/s]\u001b[A\n\nDDIM Sampler: 2%|▏ | 2/100 [00:01<00:52, 1.85it/s]\u001b[A\n\nDDIM Sampler: 3%|▎ | 3/100 [00:01<00:52, 1.85it/s]\u001b[A\n\nDDIM Sampler: 4%|▍ | 4/100 [00:02<00:51, 1.85it/s]\u001b[A\n\nDDIM Sampler: 5%|▌ | 5/100 [00:02<00:51, 1.85it/s]\u001b[A\n\nDDIM Sampler: 6%|▌ | 6/100 [00:03<00:51, 1.84it/s]\u001b[A\n\nDDIM Sampler: 7%|▋ | 7/100 [00:03<00:50, 1.84it/s]\u001b[A\n\nDDIM Sampler: 8%|▊ | 8/100 [00:04<00:50, 1.84it/s]\u001b[A\n\nDDIM Sampler: 9%|▉ | 9/100 [00:04<00:49, 1.83it/s]\u001b[A\n\nDDIM Sampler: 10%|█ | 10/100 [00:05<00:49, 1.83it/s]\u001b[A\n\nDDIM Sampler: 11%|█ | 11/100 [00:05<00:48, 1.83it/s]\u001b[A\n\nDDIM Sampler: 12%|█▏ | 12/100 [00:06<00:48, 1.83it/s]\u001b[A\n\nDDIM Sampler: 13%|█▎ | 13/100 [00:07<00:47, 1.83it/s]\u001b[A\n\nDDIM Sampler: 14%|█▍ | 14/100 [00:07<00:47, 1.83it/s]\u001b[A\n\nDDIM Sampler: 15%|█▌ | 15/100 [00:08<00:46, 1.83it/s]\u001b[A\n\nDDIM Sampler: 16%|█▌ | 16/100 [00:08<00:45, 1.83it/s]\u001b[A\n\nDDIM Sampler: 17%|█▋ | 17/100 [00:09<00:45, 1.82it/s]\u001b[A\n\nDDIM Sampler: 18%|█▊ | 18/100 [00:09<00:45, 1.81it/s]\u001b[A\n\nDDIM Sampler: 19%|█▉ | 19/100 [00:10<00:44, 1.81it/s]\u001b[A\n\nDDIM Sampler: 20%|██ | 20/100 [00:10<00:44, 1.81it/s]\u001b[A\n\nDDIM Sampler: 21%|██ | 21/100 [00:11<00:43, 1.81it/s]\u001b[A\n\nDDIM Sampler: 22%|██▏ | 22/100 [00:12<00:43, 1.80it/s]\u001b[A\n\nDDIM Sampler: 23%|██▎ | 23/100 [00:12<00:42, 1.81it/s]\u001b[A\n\nDDIM Sampler: 24%|██▍ | 24/100 [00:13<00:42, 1.80it/s]\u001b[A\n\nDDIM Sampler: 25%|██▌ | 25/100 [00:13<00:41, 1.80it/s]\u001b[A\n\nDDIM Sampler: 26%|██▌ | 26/100 [00:14<00:41, 1.79it/s]\u001b[A\n\nDDIM Sampler: 27%|██▋ | 27/100 [00:14<00:40, 1.79it/s]\u001b[A\n\nDDIM Sampler: 28%|██▊ | 28/100 [00:15<00:40, 1.79it/s]\u001b[A\n\nDDIM Sampler: 29%|██▉ | 29/100 [00:15<00:39, 1.78it/s]\u001b[A\n\nDDIM Sampler: 30%|███ | 30/100 [00:16<00:39, 1.78it/s]\u001b[A\n\nDDIM Sampler: 31%|███ | 31/100 [00:17<00:38, 1.78it/s]\u001b[A\n\nDDIM Sampler: 32%|███▏ | 32/100 [00:17<00:38, 1.78it/s]\u001b[A\n\nDDIM Sampler: 33%|███▎ | 33/100 [00:18<00:37, 1.77it/s]\u001b[A\n\nDDIM Sampler: 34%|███▍ | 34/100 [00:18<00:37, 1.77it/s]\u001b[A\n\nDDIM Sampler: 35%|███▌ | 35/100 [00:19<00:36, 1.77it/s]\u001b[A\n\nDDIM Sampler: 36%|███▌ | 36/100 [00:19<00:36, 1.76it/s]\u001b[A\n\nDDIM Sampler: 37%|███▋ | 37/100 [00:20<00:35, 1.76it/s]\u001b[A\n\nDDIM Sampler: 38%|███▊ | 38/100 [00:21<00:35, 1.76it/s]\u001b[A\n\nDDIM Sampler: 39%|███▉ | 39/100 [00:21<00:34, 1.75it/s]\u001b[A\n\nDDIM Sampler: 40%|████ | 40/100 [00:22<00:34, 1.75it/s]\u001b[A\n\nDDIM Sampler: 41%|████ | 41/100 [00:22<00:33, 1.74it/s]\u001b[A\n\nDDIM Sampler: 42%|████▏ | 42/100 [00:23<00:33, 1.74it/s]\u001b[A\n\nDDIM Sampler: 43%|████▎ | 43/100 [00:23<00:32, 1.74it/s]\u001b[A\n\nDDIM Sampler: 44%|████▍ | 44/100 [00:24<00:32, 1.74it/s]\u001b[A\n\nDDIM Sampler: 45%|████▌ | 45/100 [00:25<00:31, 1.73it/s]\u001b[A\n\nDDIM Sampler: 46%|████▌ | 46/100 [00:25<00:31, 1.73it/s]\u001b[A\n\nDDIM Sampler: 47%|████▋ | 47/100 [00:26<00:30, 1.73it/s]\u001b[A\n\nDDIM Sampler: 48%|████▊ | 48/100 [00:26<00:30, 1.73it/s]\u001b[A\n\nDDIM Sampler: 49%|████▉ | 49/100 [00:27<00:29, 1.73it/s]\u001b[A\n\nDDIM Sampler: 50%|█████ | 50/100 [00:28<00:28, 1.72it/s]\u001b[A\n\nDDIM Sampler: 51%|█████ | 51/100 [00:28<00:28, 1.72it/s]\u001b[A\n\nDDIM Sampler: 52%|█████▏ | 52/100 [00:29<00:27, 1.72it/s]\u001b[A\n\nDDIM Sampler: 53%|█████▎ | 53/100 [00:29<00:27, 1.72it/s]\u001b[A\n\nDDIM Sampler: 54%|█████▍ | 54/100 [00:30<00:26, 1.72it/s]\u001b[A\n\nDDIM Sampler: 55%|█████▌ | 55/100 [00:30<00:26, 1.71it/s]\u001b[A\n\nDDIM Sampler: 56%|█████▌ | 56/100 [00:31<00:25, 1.71it/s]\u001b[A\n\nDDIM Sampler: 57%|█████▋ | 57/100 [00:32<00:25, 1.71it/s]\u001b[A\n\nDDIM Sampler: 58%|█████▊ | 58/100 [00:32<00:24, 1.71it/s]\u001b[A\n\nDDIM Sampler: 59%|█████▉ | 59/100 [00:33<00:23, 1.72it/s]\u001b[A\n\nDDIM Sampler: 60%|██████ | 60/100 [00:33<00:23, 1.72it/s]\u001b[A\n\nDDIM Sampler: 61%|██████ | 61/100 [00:34<00:22, 1.72it/s]\u001b[A\n\nDDIM Sampler: 62%|██████▏ | 62/100 [00:34<00:22, 1.72it/s]\u001b[A\n\nDDIM Sampler: 63%|██████▎ | 63/100 [00:35<00:21, 1.73it/s]\u001b[A\n\nDDIM Sampler: 64%|██████▍ | 64/100 [00:36<00:20, 1.73it/s]\u001b[A\n\nDDIM Sampler: 65%|██████▌ | 65/100 [00:36<00:20, 1.73it/s]\u001b[A\n\nDDIM Sampler: 66%|██████▌ | 66/100 [00:37<00:19, 1.73it/s]\u001b[A\n\nDDIM Sampler: 67%|██████▋ | 67/100 [00:37<00:19, 1.74it/s]\u001b[A\n\nDDIM Sampler: 68%|██████▊ | 68/100 [00:38<00:18, 1.74it/s]\u001b[A\n\nDDIM Sampler: 69%|██████▉ | 69/100 [00:39<00:17, 1.75it/s]\u001b[A\n\nDDIM Sampler: 70%|███████ | 70/100 [00:39<00:17, 1.74it/s]\u001b[A\n\nDDIM Sampler: 71%|███████ | 71/100 [00:40<00:16, 1.74it/s]\u001b[A\n\nDDIM Sampler: 72%|███████▏ | 72/100 [00:40<00:16, 1.75it/s]\u001b[A\n\nDDIM Sampler: 73%|███████▎ | 73/100 [00:41<00:15, 1.75it/s]\u001b[A\n\nDDIM Sampler: 74%|███████▍ | 74/100 [00:41<00:14, 1.76it/s]\u001b[A\n\nDDIM Sampler: 75%|███████▌ | 75/100 [00:42<00:14, 1.76it/s]\u001b[A\n\nDDIM Sampler: 76%|███████▌ | 76/100 [00:42<00:13, 1.76it/s]\u001b[A\n\nDDIM Sampler: 77%|███████▋ | 77/100 [00:43<00:13, 1.76it/s]\u001b[A\n\nDDIM Sampler: 78%|███████▊ | 78/100 [00:44<00:12, 1.76it/s]\u001b[A\n\nDDIM Sampler: 79%|███████▉ | 79/100 [00:44<00:11, 1.77it/s]\u001b[A\n\nDDIM Sampler: 80%|████████ | 80/100 [00:45<00:11, 1.77it/s]\u001b[A\n\nDDIM Sampler: 81%|████████ | 81/100 [00:45<00:10, 1.77it/s]\u001b[A\n\nDDIM Sampler: 82%|████████▏ | 82/100 [00:46<00:10, 1.77it/s]\u001b[A\n\nDDIM Sampler: 83%|████████▎ | 83/100 [00:46<00:09, 1.77it/s]\u001b[A\n\nDDIM Sampler: 84%|████████▍ | 84/100 [00:47<00:09, 1.77it/s]\u001b[A\n\nDDIM Sampler: 85%|████████▌ | 85/100 [00:48<00:08, 1.77it/s]\u001b[A\n\nDDIM Sampler: 86%|████████▌ | 86/100 [00:48<00:07, 1.77it/s]\u001b[A\n\nDDIM Sampler: 87%|████████▋ | 87/100 [00:49<00:07, 1.78it/s]\u001b[A\n\nDDIM Sampler: 88%|████████▊ | 88/100 [00:49<00:06, 1.78it/s]\u001b[A\n\nDDIM Sampler: 89%|████████▉ | 89/100 [00:50<00:06, 1.78it/s]\u001b[A\n\nDDIM Sampler: 90%|█████████ | 90/100 [00:50<00:05, 1.79it/s]\u001b[A\n\nDDIM Sampler: 91%|█████████ | 91/100 [00:51<00:05, 1.78it/s]\u001b[A\n\nDDIM Sampler: 92%|█████████▏| 92/100 [00:51<00:04, 1.79it/s]\u001b[A\n\nDDIM Sampler: 93%|█████████▎| 93/100 [00:52<00:03, 1.79it/s]\u001b[A\n\nDDIM Sampler: 94%|█████████▍| 94/100 [00:53<00:03, 1.80it/s]\u001b[A\n\nDDIM Sampler: 95%|█████████▌| 95/100 [00:53<00:02, 1.80it/s]\u001b[A\n\nDDIM Sampler: 96%|█████████▌| 96/100 [00:54<00:02, 1.80it/s]\u001b[A\n\nDDIM Sampler: 97%|█████████▋| 97/100 [00:54<00:01, 1.80it/s]\u001b[A\n\nDDIM Sampler: 98%|█████████▊| 98/100 [00:55<00:01, 1.80it/s]\u001b[A\n\nDDIM Sampler: 99%|█████████▉| 99/100 [00:55<00:00, 1.81it/s]\u001b[A\n\nDDIM Sampler: 100%|██████████| 100/100 [00:56<00:00, 1.81it/s]\u001b[A\nDDIM Sampler: 100%|██████████| 100/100 [00:56<00:00, 1.77it/s]\n\nSampling: 100%|██████████| 1/1 [00:57<00:00, 57.29s/it]\nSampling: 100%|██████████| 1/1 [00:57<00:00, 57.29s/it]",
"output": [
"https://replicate.delivery/mgxm/ff92ae5e-806b-4e39-bd7c-3a6279aec266/8de0f698-6812-4f52-bc43-b8e70262ea5a.png",
"https://replicate.delivery/mgxm/2d814af3-b2b6-41c3-9007-df9c5d130316/e58ac926-d0c9-4aa1-89f4-31460f0fd0c6.png",
"https://replicate.delivery/mgxm/574c5b57-1f95-4842-a630-b7a724124fb2/66482d1a-a3cb-42f6-8be0-f9b03e19fedd.png",
"https://replicate.delivery/mgxm/c2a27b3f-d0c5-49d0-a996-538db17073b4/a29589fb-5b36-4f0c-8d30-2ae0f3042f4a.png"
],
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2022-06-24T20:12:25.078186Z",
"started_at": "2022-06-24T20:12:25.236686Z",
"completed_at": "2022-06-24T20:13:24.0999Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/spi4ffj46baktckvxrgs2nucbq/cancel",
"get": "https://api.replicate.com/v1/predictions/spi4ffj46baktckvxrgs2nucbq"
},
"metrics": {
"predict_time": 58.863214,
"total_time": 59.021714
}
}


