{
"controlnet_conditioning_scale": 1,
"image": "https://unsplash.com/photos/AYIeSFWhEB8/download?force=true&w=640",
"negative_prompt": "3d, cgi, render, bad quality, normal quality",
"num_inference_steps": 30,
"num_outputs": 1,
"prompt": "A Shoe on a marble podium, product photography, high resolution"
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_Lxj**********************************
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 dhanushreddy291/photo-background-generation using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const output = await replicate.run(
"dhanushreddy291/photo-background-generation:1db5ee211d65558d3fd11fc60bc00073f300d7a3a0b5abbfafbd20239ac58d2f",
{
input: {
controlnet_conditioning_scale: 1,
image: "https://unsplash.com/photos/AYIeSFWhEB8/download?force=true&w=640",
negative_prompt: "3d, cgi, render, bad quality, normal quality",
num_inference_steps: 30,
num_outputs: 1,
prompt: "A Shoe on a marble podium, product photography, high resolution"
}
}
);
// 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_Lxj**********************************
This is your API token. Keep it to yourself.
import replicate
Run dhanushreddy291/photo-background-generation using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"dhanushreddy291/photo-background-generation:1db5ee211d65558d3fd11fc60bc00073f300d7a3a0b5abbfafbd20239ac58d2f",
input={
"controlnet_conditioning_scale": 1,
"image": "https://unsplash.com/photos/AYIeSFWhEB8/download?force=true&w=640",
"negative_prompt": "3d, cgi, render, bad quality, normal quality",
"num_inference_steps": 30,
"num_outputs": 1,
"prompt": "A Shoe on a marble podium, product photography, high resolution"
}
)
# 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_Lxj**********************************
This is your API token. Keep it to yourself.
Run dhanushreddy291/photo-background-generation 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": "dhanushreddy291/photo-background-generation:1db5ee211d65558d3fd11fc60bc00073f300d7a3a0b5abbfafbd20239ac58d2f",
"input": {
"controlnet_conditioning_scale": 1,
"image": "https://unsplash.com/photos/AYIeSFWhEB8/download?force=true&w=640",
"negative_prompt": "3d, cgi, render, bad quality, normal quality",
"num_inference_steps": 30,
"num_outputs": 1,
"prompt": "A Shoe on a marble podium, product photography, high resolution"
}
}' \
https://api.replicate.com/v1/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
{
"id": "wv7t4cxxk9rgm0cg3bws0708a8",
"model": "dhanushreddy291/photo-background-generation",
"version": "1db5ee211d65558d3fd11fc60bc00073f300d7a3a0b5abbfafbd20239ac58d2f",
"input": {
"controlnet_conditioning_scale": 1,
"image": "https://unsplash.com/photos/AYIeSFWhEB8/download?force=true&w=640",
"negative_prompt": "3d, cgi, render, bad quality, normal quality",
"num_inference_steps": 30,
"num_outputs": 1,
"prompt": "A Shoe on a marble podium, product photography, high resolution"
},
"logs": "Using seed: 11152876\n/root/.pyenv/versions/3.10.14/lib/python3.10/site-packages/torch/functional.py:504: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at ../aten/src/ATen/native/TensorShape.cpp:3190.)\nreturn _VF.meshgrid(tensors, **kwargs) # type: ignore[attr-defined]\nSettings -> Mode=base, Device=cuda:0, Torchscript=disabled\nSettings -> Mode=base, Device=cuda:0, Torchscript=disabled\n 0%| | 0/30 [00:00<?, ?it/s]\n 3%|▎ | 1/30 [00:00<00:04, 6.87it/s]\n 10%|█ | 3/30 [00:00<00:03, 8.11it/s]\n 17%|█▋ | 5/30 [00:00<00:02, 9.38it/s]\n 23%|██▎ | 7/30 [00:00<00:02, 10.02it/s]\n 30%|███ | 9/30 [00:00<00:02, 10.38it/s]\n 37%|███▋ | 11/30 [00:01<00:01, 10.60it/s]\n 43%|████▎ | 13/30 [00:01<00:01, 10.72it/s]\n 50%|█████ | 15/30 [00:01<00:01, 10.79it/s]\n 57%|█████▋ | 17/30 [00:01<00:01, 10.86it/s]\n 63%|██████▎ | 19/30 [00:01<00:01, 10.92it/s]\n 70%|███████ | 21/30 [00:02<00:00, 10.96it/s]\n 77%|███████▋ | 23/30 [00:02<00:00, 10.97it/s]\n 83%|████████▎ | 25/30 [00:02<00:00, 10.98it/s]\n 90%|█████████ | 27/30 [00:02<00:00, 11.00it/s]\n 97%|█████████▋| 29/30 [00:02<00:00, 11.01it/s]\n100%|██████████| 30/30 [00:02<00:00, 10.61it/s]",
"output": [
"https://replicate.delivery/pbxt/b8wxAZmKEmJ0NVXe7ckd7v3uvOOriLwg5HieLpU8RYkGDwelA/out-0.png"
],
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2024-06-15T08:18:13.018Z",
"started_at": "2024-06-15T08:20:12.750099Z",
"completed_at": "2024-06-15T08:20:23.483619Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/wv7t4cxxk9rgm0cg3bws0708a8/cancel",
"get": "https://api.replicate.com/v1/predictions/wv7t4cxxk9rgm0cg3bws0708a8",
"web": "https://replicate.com/p/wv7t4cxxk9rgm0cg3bws0708a8"
},
"metrics": {
"predict_time": 10.733520402,
"total_time": 130.465619
}
}