typetext
{
"bottom": 150,
"image": "https://i.postimg.cc/PrR5JK6c/Comfy-UI-temp-xdxpz-00001.png",
"left": 150,
"negative_prompt": "ugly",
"output_format": "webp",
"output_quality": 80,
"prompt": "grass field, sunset, clouds",
"right": 150,
"top": 150
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_Dda**********************************
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 emaph/outpaint-controlnet-union using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const output = await replicate.run(
"emaph/outpaint-controlnet-union:3947eb8cde7f5953837f7f25b5b8ae7bb4e0c65ba38d1662d516c537cd6785e0",
{
input: {
bottom: 150,
image: "https://i.postimg.cc/PrR5JK6c/Comfy-UI-temp-xdxpz-00001.png",
left: 150,
negative_prompt: "ugly",
output_format: "webp",
output_quality: 80,
prompt: "grass field, sunset, clouds",
right: 150,
top: 150
}
}
);
// 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_Dda**********************************
This is your API token. Keep it to yourself.
import replicate
Run emaph/outpaint-controlnet-union using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"emaph/outpaint-controlnet-union:3947eb8cde7f5953837f7f25b5b8ae7bb4e0c65ba38d1662d516c537cd6785e0",
input={
"bottom": 150,
"image": "https://i.postimg.cc/PrR5JK6c/Comfy-UI-temp-xdxpz-00001.png",
"left": 150,
"negative_prompt": "ugly",
"output_format": "webp",
"output_quality": 80,
"prompt": "grass field, sunset, clouds",
"right": 150,
"top": 150
}
)
# 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_Dda**********************************
This is your API token. Keep it to yourself.
Run emaph/outpaint-controlnet-union 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": "emaph/outpaint-controlnet-union:3947eb8cde7f5953837f7f25b5b8ae7bb4e0c65ba38d1662d516c537cd6785e0",
"input": {
"bottom": 150,
"image": "https://i.postimg.cc/PrR5JK6c/Comfy-UI-temp-xdxpz-00001.png",
"left": 150,
"negative_prompt": "ugly",
"output_format": "webp",
"output_quality": 80,
"prompt": "grass field, sunset, clouds",
"right": 150,
"top": 150
}
}' \
https://api.replicate.com/v1/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
{
"id": "6fvgec3bx9rge0cgyq2vpehgam",
"model": "emaph/outpaint-controlnet-union",
"version": "3947eb8cde7f5953837f7f25b5b8ae7bb4e0c65ba38d1662d516c537cd6785e0",
"input": {
"bottom": 150,
"image": "https://i.postimg.cc/PrR5JK6c/Comfy-UI-temp-xdxpz-00001.png",
"left": 150,
"negative_prompt": "ugly",
"output_format": "webp",
"output_quality": 80,
"prompt": "grass field, sunset, clouds",
"right": 150,
"top": 150
},
"logs": "Random seed set to: 3062084987\nChecking inputs\nDownloading https://i.postimg.cc/PrR5JK6c/Comfy-UI-temp-xdxpz-00001.png to /tmp/inputs/Comfy-UI-temp-xdxpz-00001.png\n✅ /tmp/inputs/Comfy-UI-temp-xdxpz-00001.png\n====================================\nRunning workflow\ngot prompt\nExecuting node 4, title: Load Checkpoint, class type: CheckpointLoaderSimple\nmodel_type EPS\nUsing pytorch attention in VAE\nUsing pytorch attention in VAE\nloaded straight to GPU\nRequested to load SDXL\nLoading 1 new model\nExecuting node 6, title: Positive, class type: CLIPTextEncode\nRequested to load SDXLClipModel\nLoading 1 new model\nExecuting node 7, title: Negetive, class type: CLIPTextEncode\nExecuting node 16, title: Load ControlNet Model, class type: ControlNetLoader\nExecuting node 17, title: SetUnionControlNetType, class type: SetUnionControlNetType\nExecuting node 11, title: Load Image, class type: LoadImage\nExecuting node 10, title: Pad Image for Outpainting, class type: ImagePadForOutpaint\nExecuting node 48, title: InvertMask, class type: InvertMask\nExecuting node 47, title: Convert Mask to Image, class type: MaskToImage\nExecuting node 49, title: ImageCompositeMasked, class type: ImageCompositeMasked\nExecuting node 15, title: Apply ControlNet (Advanced), class type: ControlNetApplyAdvanced\nExecuting node 39, title: VAE Encode (for Inpainting), class type: VAEEncodeForInpaint\nRequested to load AutoencoderKL\nLoading 1 new model\nExecuting node 3, title: KSampler, class type: KSampler\nRequested to load ControlNet\nLoading 1 new model\n 0%| | 0/26 [00:00<?, ?it/s]\n 4%|▍ | 1/26 [00:01<00:37, 1.48s/it]\n 8%|▊ | 2/26 [00:02<00:34, 1.43s/it]\n 12%|█▏ | 3/26 [00:04<00:32, 1.41s/it]\n 15%|█▌ | 4/26 [00:05<00:30, 1.40s/it]\n 19%|█▉ | 5/26 [00:07<00:29, 1.40s/it]\n 23%|██▎ | 6/26 [00:08<00:27, 1.40s/it]\n 27%|██▋ | 7/26 [00:09<00:26, 1.40s/it]\n 31%|███ | 8/26 [00:11<00:25, 1.40s/it]\n 35%|███▍ | 9/26 [00:12<00:23, 1.41s/it]\n 38%|███▊ | 10/26 [00:14<00:22, 1.40s/it]\n 42%|████▏ | 11/26 [00:15<00:21, 1.41s/it]\n 46%|████▌ | 12/26 [00:16<00:19, 1.41s/it]\n 50%|█████ | 13/26 [00:18<00:18, 1.41s/it]\n 54%|█████▍ | 14/26 [00:19<00:16, 1.41s/it]\n 58%|█████▊ | 15/26 [00:21<00:15, 1.42s/it]\n 62%|██████▏ | 16/26 [00:22<00:14, 1.42s/it]\n 65%|██████▌ | 17/26 [00:23<00:12, 1.42s/it]\n 69%|██████▉ | 18/26 [00:25<00:11, 1.43s/it]\n 73%|███████▎ | 19/26 [00:26<00:10, 1.43s/it]\n 77%|███████▋ | 20/26 [00:28<00:08, 1.44s/it]\n 81%|████████ | 21/26 [00:29<00:07, 1.44s/it]\n 85%|████████▍ | 22/26 [00:31<00:05, 1.45s/it]\n 88%|████████▊ | 23/26 [00:32<00:04, 1.45s/it]\n 92%|█████████▏| 24/26 [00:34<00:02, 1.46s/it]\n 96%|█████████▌| 25/26 [00:35<00:01, 1.46s/it]\n100%|██████████| 26/26 [00:37<00:00, 1.47s/it]\n100%|██████████| 26/26 [00:37<00:00, 1.43s/it]\nExecuting node 8, title: VAE Decode, class type: VAEDecode\nExecuting node 58, title: ImageCompositeMasked, class type: ImageCompositeMasked\nExecuting node 65, title: Save Image, class type: SaveImage\nPrompt executed in 53.09 seconds\noutputs: {'65': {'images': [{'filename': 'outpainted_00001_.png', 'subfolder': '', 'type': 'output'}]}}\n====================================\noutpainted_00001_.png",
"output": [
"https://replicate.delivery/czjl/cBsfmDDMoEzOdy4bF517fnm4XxVKns8vNR4dJx3ODv8FSwMTA/outpainted_00001_.webp"
],
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2024-07-27T19:57:54.538Z",
"started_at": "2024-07-27T20:02:23.525489Z",
"completed_at": "2024-07-27T20:03:17.987029Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/6fvgec3bx9rge0cgyq2vpehgam/cancel",
"get": "https://api.replicate.com/v1/predictions/6fvgec3bx9rge0cgyq2vpehgam",
"web": "https://replicate.com/p/6fvgec3bx9rge0cgyq2vpehgam"
},
"metrics": {
"predict_time": 54.461539476,
"total_time": 323.449029
}
}