{
"ddim_steps": 50,
"input_image": "https://replicate.delivery/pbxt/Ht9ktaU1U38SsOQVcOB20R2VglJa1acajY7FUVtbFllthgZK/42.jpg"
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_SOb**********************************
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 arielreplicate/stable_diffusion2_upscaling using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const output = await replicate.run(
"arielreplicate/stable_diffusion2_upscaling:03dff174cad79bb5bee287d5ac9d523dbc236c97f4aeb694f6f0adaf79bcf8f7",
{
input: {
ddim_steps: 50,
input_image: "https://replicate.delivery/pbxt/Ht9ktaU1U38SsOQVcOB20R2VglJa1acajY7FUVtbFllthgZK/42.jpg"
}
}
);
// 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_SOb**********************************
This is your API token. Keep it to yourself.
import replicate
Run arielreplicate/stable_diffusion2_upscaling using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"arielreplicate/stable_diffusion2_upscaling:03dff174cad79bb5bee287d5ac9d523dbc236c97f4aeb694f6f0adaf79bcf8f7",
input={
"ddim_steps": 50,
"input_image": "https://replicate.delivery/pbxt/Ht9ktaU1U38SsOQVcOB20R2VglJa1acajY7FUVtbFllthgZK/42.jpg"
}
)
# 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_SOb**********************************
This is your API token. Keep it to yourself.
Run arielreplicate/stable_diffusion2_upscaling 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": "arielreplicate/stable_diffusion2_upscaling:03dff174cad79bb5bee287d5ac9d523dbc236c97f4aeb694f6f0adaf79bcf8f7",
"input": {
"ddim_steps": 50,
"input_image": "https://replicate.delivery/pbxt/Ht9ktaU1U38SsOQVcOB20R2VglJa1acajY7FUVtbFllthgZK/42.jpg"
}
}' \
https://api.replicate.com/v1/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
{
"id": "ip4btnartnfy5lno7xmjvvhgbi",
"model": "arielreplicate/stable_diffusion2_upscaling",
"version": "03dff174cad79bb5bee287d5ac9d523dbc236c97f4aeb694f6f0adaf79bcf8f7",
"input": {
"ddim_steps": 50,
"input_image": "https://replicate.delivery/pbxt/Ht9ktaU1U38SsOQVcOB20R2VglJa1acajY7FUVtbFllthgZK/42.jpg"
},
"logs": "Selected timesteps for ddim sampler: [ 1 21 41 61 81 101 121 141 161 181 201 221 241 261 281 301 321 341\n361 381 401 421 441 461 481 501 521 541 561 581 601 621 641 661 681 701\n721 741 761 781 801 821 841 861 881 901 921 941 961 981]\nSelected alphas for ddim sampler: a_t: tensor([0.9998, 0.9971, 0.9931, 0.9876, 0.9801, 0.9706, 0.9589, 0.9447, 0.9279,\n0.9084, 0.8862, 0.8611, 0.8334, 0.8030, 0.7700, 0.7348, 0.6976, 0.6585,\n0.6181, 0.5766, 0.5345, 0.4922, 0.4501, 0.4087, 0.3683, 0.3294, 0.2922,\n0.2570, 0.2242, 0.1938, 0.1660, 0.1408, 0.1183, 0.0984, 0.0811, 0.0660,\n0.0532, 0.0424, 0.0334, 0.0260, 0.0200, 0.0152, 0.0114, 0.0085, 0.0062,\n0.0045, 0.0032, 0.0022, 0.0015, 0.0010]); a_(t-1): [0.99989998 0.99979734 0.99713886 0.99314541 0.98755956 0.98013663\n0.97064948 0.9588933 0.94469088 0.92789799 0.90840852 0.88615978\n0.86113644 0.83337462 0.80296397 0.77004915 0.73482919 0.6975556\n0.65852839 0.61809063 0.57662094 0.53452456 0.49222353 0.45014533\n0.40871155 0.3683264 0.32936576 0.29216716 0.2570214 0.22416589\n0.19378017 0.16598386 0.14083675 0.11834133 0.09844732 0.08105777\n0.06603664 0.05321705 0.04240997 0.03341274 0.02601707 0.02001623\n0.01521103 0.01141463 0.00845604 0.00618227 0.00445942 0.00317273\n0.00222579 0.00153924]\nFor the chosen value of eta, which is 0.0, this results in the following sigma_t schedule for ddim sampler tensor([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,\n0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,\n0., 0.], dtype=torch.float64)\nGlobal seed set to 0\nCreating invisible watermark encoder (see https://github.com/ShieldMnt/invisible-watermark)...\nData shape for DDIM sampling is (1, 4, 256, 256), eta 0.0\nRunning DDIM Sampling with 50 timesteps\nDDIM Sampler: 0%| | 0/50 [00:00<?, ?it/s]\nDDIM Sampler: 2%|▏ | 1/50 [00:04<03:45, 4.60s/it]\nDDIM Sampler: 4%|▍ | 2/50 [00:04<01:34, 1.98s/it]\nDDIM Sampler: 6%|▌ | 3/50 [00:04<00:53, 1.14s/it]\nDDIM Sampler: 8%|▊ | 4/50 [00:05<00:34, 1.35it/s]\nDDIM Sampler: 10%|█ | 5/50 [00:05<00:23, 1.91it/s]\nDDIM Sampler: 12%|█▏ | 6/50 [00:05<00:17, 2.54it/s]\nDDIM Sampler: 14%|█▍ | 7/50 [00:05<00:13, 3.23it/s]\nDDIM Sampler: 16%|█▌ | 8/50 [00:05<00:10, 3.92it/s]\nDDIM Sampler: 18%|█▊ | 9/50 [00:05<00:08, 4.58it/s]\nDDIM Sampler: 20%|██ | 10/50 [00:05<00:07, 5.17it/s]\nDDIM Sampler: 22%|██▏ | 11/50 [00:05<00:06, 5.68it/s]\nDDIM Sampler: 24%|██▍ | 12/50 [00:06<00:06, 6.08it/s]\nDDIM Sampler: 26%|██▌ | 13/50 [00:06<00:05, 6.40it/s]\nDDIM Sampler: 28%|██▊ | 14/50 [00:06<00:05, 6.64it/s]\nDDIM Sampler: 30%|███ | 15/50 [00:06<00:05, 6.82it/s]\nDDIM Sampler: 32%|███▏ | 16/50 [00:06<00:04, 6.94it/s]\nDDIM Sampler: 34%|███▍ | 17/50 [00:06<00:04, 7.03it/s]\nDDIM Sampler: 36%|███▌ | 18/50 [00:06<00:04, 7.10it/s]\nDDIM Sampler: 38%|███▊ | 19/50 [00:07<00:04, 7.15it/s]\nDDIM Sampler: 40%|████ | 20/50 [00:07<00:04, 7.19it/s]\nDDIM Sampler: 42%|████▏ | 21/50 [00:07<00:04, 7.21it/s]\nDDIM Sampler: 44%|████▍ | 22/50 [00:07<00:03, 7.22it/s]\nDDIM Sampler: 46%|████▌ | 23/50 [00:07<00:03, 7.23it/s]\nDDIM Sampler: 48%|████▊ | 24/50 [00:07<00:03, 7.24it/s]\nDDIM Sampler: 50%|█████ | 25/50 [00:07<00:03, 7.23it/s]\nDDIM Sampler: 52%|█████▏ | 26/50 [00:08<00:03, 7.24it/s]\nDDIM Sampler: 54%|█████▍ | 27/50 [00:08<00:03, 7.25it/s]\nDDIM Sampler: 56%|█████▌ | 28/50 [00:08<00:03, 7.25it/s]\nDDIM Sampler: 58%|█████▊ | 29/50 [00:08<00:02, 7.25it/s]\nDDIM Sampler: 60%|██████ | 30/50 [00:08<00:02, 7.26it/s]\nDDIM Sampler: 62%|██████▏ | 31/50 [00:08<00:02, 7.26it/s]\nDDIM Sampler: 64%|██████▍ | 32/50 [00:08<00:02, 7.26it/s]\nDDIM Sampler: 66%|██████▌ | 33/50 [00:09<00:02, 7.25it/s]\nDDIM Sampler: 68%|██████▊ | 34/50 [00:09<00:02, 7.26it/s]\nDDIM Sampler: 70%|███████ | 35/50 [00:09<00:02, 7.26it/s]\nDDIM Sampler: 72%|███████▏ | 36/50 [00:09<00:01, 7.26it/s]\nDDIM Sampler: 74%|███████▍ | 37/50 [00:09<00:01, 7.26it/s]\nDDIM Sampler: 76%|███████▌ | 38/50 [00:09<00:01, 7.26it/s]\nDDIM Sampler: 78%|███████▊ | 39/50 [00:09<00:01, 7.26it/s]\nDDIM Sampler: 80%|████████ | 40/50 [00:09<00:01, 7.16it/s]\nDDIM Sampler: 82%|████████▏ | 41/50 [00:10<00:01, 7.19it/s]\nDDIM Sampler: 84%|████████▍ | 42/50 [00:10<00:01, 7.21it/s]\nDDIM Sampler: 86%|████████▌ | 43/50 [00:10<00:00, 7.22it/s]\nDDIM Sampler: 88%|████████▊ | 44/50 [00:10<00:00, 7.22it/s]\nDDIM Sampler: 90%|█████████ | 45/50 [00:10<00:00, 7.23it/s]\nDDIM Sampler: 92%|█████████▏| 46/50 [00:10<00:00, 7.23it/s]\nDDIM Sampler: 94%|█████████▍| 47/50 [00:10<00:00, 7.11it/s]\nDDIM Sampler: 96%|█████████▌| 48/50 [00:11<00:00, 7.15it/s]\nDDIM Sampler: 98%|█████████▊| 49/50 [00:11<00:00, 7.17it/s]\nDDIM Sampler: 100%|██████████| 50/50 [00:11<00:00, 7.19it/s]\nDDIM Sampler: 100%|██████████| 50/50 [00:11<00:00, 4.40it/s]",
"output": [
"https://replicate.delivery/pbxt/bKBrxkXJ7LZrEpFI3q33lnmmDveQBFVDcnek3pSOMb6wM5FQA/output-0.png"
],
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2022-12-02T11:24:09.624664Z",
"started_at": "2022-12-02T11:27:30.208747Z",
"completed_at": "2022-12-02T11:27:45.263362Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/ip4btnartnfy5lno7xmjvvhgbi/cancel",
"get": "https://api.replicate.com/v1/predictions/ip4btnartnfy5lno7xmjvvhgbi"
},
"metrics": {
"predict_time": 15.054615,
"total_time": 215.638698
}
}
