typefile
{
"guidance_scale": 7.5,
"image": "https://replicate.delivery/pbxt/IBnrzJD8Vvz3rD7yF5W8ODnpeA5wcoNpP1RRiDutqW1nG8eF/example.jpeg",
"image_guidance_scale": 1.5,
"num_inference_steps": 100,
"num_outputs": 1,
"prompt": "turn him into cyborg",
"scheduler": "K_EULER_ANCESTRAL"
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_9UH**********************************
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 timothybrooks/instruct-pix2pix using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const output = await replicate.run(
"timothybrooks/instruct-pix2pix:30c1d0b916a6f8efce20493f5d61ee27491ab2a60437c13c588468b9810ec23f",
{
input: {
guidance_scale: 7.5,
image: "https://replicate.delivery/pbxt/IBnrzJD8Vvz3rD7yF5W8ODnpeA5wcoNpP1RRiDutqW1nG8eF/example.jpeg",
image_guidance_scale: 1.5,
num_inference_steps: 100,
num_outputs: 1,
prompt: "turn him into cyborg",
scheduler: "K_EULER_ANCESTRAL"
}
}
);
// 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_9UH**********************************
This is your API token. Keep it to yourself.
import replicate
Run timothybrooks/instruct-pix2pix using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"timothybrooks/instruct-pix2pix:30c1d0b916a6f8efce20493f5d61ee27491ab2a60437c13c588468b9810ec23f",
input={
"guidance_scale": 7.5,
"image": "https://replicate.delivery/pbxt/IBnrzJD8Vvz3rD7yF5W8ODnpeA5wcoNpP1RRiDutqW1nG8eF/example.jpeg",
"image_guidance_scale": 1.5,
"num_inference_steps": 100,
"num_outputs": 1,
"prompt": "turn him into cyborg",
"scheduler": "K_EULER_ANCESTRAL"
}
)
# 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_9UH**********************************
This is your API token. Keep it to yourself.
Run timothybrooks/instruct-pix2pix 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": "timothybrooks/instruct-pix2pix:30c1d0b916a6f8efce20493f5d61ee27491ab2a60437c13c588468b9810ec23f",
"input": {
"guidance_scale": 7.5,
"image": "https://replicate.delivery/pbxt/IBnrzJD8Vvz3rD7yF5W8ODnpeA5wcoNpP1RRiDutqW1nG8eF/example.jpeg",
"image_guidance_scale": 1.5,
"num_inference_steps": 100,
"num_outputs": 1,
"prompt": "turn him into cyborg",
"scheduler": "K_EULER_ANCESTRAL"
}
}' \
https://api.replicate.com/v1/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
{
"id": "j5myyosmjbcpjcqesowun6idie",
"model": "timothybrooks/instruct-pix2pix",
"version": "30c1d0b916a6f8efce20493f5d61ee27491ab2a60437c13c588468b9810ec23f",
"input": {
"guidance_scale": 7.5,
"image": "https://replicate.delivery/pbxt/IBnrzJD8Vvz3rD7yF5W8ODnpeA5wcoNpP1RRiDutqW1nG8eF/example.jpeg",
"image_guidance_scale": 1.5,
"num_inference_steps": 100,
"num_outputs": 1,
"prompt": "turn him into cyborg",
"scheduler": "K_EULER_ANCESTRAL"
},
"logs": "Using seed: 49287\n 0%| | 0/100 [00:00<?, ?it/s]\n 2%|▏ | 2/100 [00:00<00:08, 11.55it/s]\n 4%|▍ | 4/100 [00:00<00:07, 13.57it/s]\n 6%|▌ | 6/100 [00:00<00:06, 14.33it/s]\n 8%|▊ | 8/100 [00:00<00:06, 14.36it/s]\n 10%|█ | 10/100 [00:00<00:06, 14.37it/s]\n 12%|█▏ | 12/100 [00:00<00:06, 14.28it/s]\n 14%|█▍ | 14/100 [00:01<00:06, 13.74it/s]\n 16%|█▌ | 16/100 [00:01<00:06, 13.40it/s]\n 18%|█▊ | 18/100 [00:01<00:06, 13.54it/s]\n 20%|██ | 20/100 [00:01<00:05, 13.78it/s]\n 22%|██▏ | 22/100 [00:01<00:05, 14.24it/s]\n 24%|██▍ | 24/100 [00:01<00:05, 14.35it/s]\n 26%|██▌ | 26/100 [00:01<00:05, 14.23it/s]\n 28%|██▊ | 28/100 [00:02<00:05, 14.06it/s]\n 30%|███ | 30/100 [00:02<00:04, 14.07it/s]\n 32%|███▏ | 32/100 [00:02<00:04, 14.57it/s]\n 34%|███▍ | 34/100 [00:02<00:04, 14.28it/s]\n 36%|███▌ | 36/100 [00:02<00:04, 14.23it/s]\n 38%|███▊ | 38/100 [00:02<00:04, 14.30it/s]\n 40%|████ | 40/100 [00:02<00:04, 14.16it/s]\n 42%|████▏ | 42/100 [00:02<00:04, 14.41it/s]\n 44%|████▍ | 44/100 [00:03<00:03, 14.42it/s]\n 46%|████▌ | 46/100 [00:03<00:03, 14.46it/s]\n 48%|████▊ | 48/100 [00:03<00:03, 14.72it/s]\n 50%|█████ | 50/100 [00:03<00:03, 14.77it/s]\n 52%|█████▏ | 52/100 [00:03<00:03, 14.87it/s]\n 54%|█████▍ | 54/100 [00:03<00:03, 14.31it/s]\n 56%|█████▌ | 56/100 [00:03<00:02, 14.74it/s]\n 58%|█████▊ | 58/100 [00:04<00:02, 14.89it/s]\n 60%|██████ | 60/100 [00:04<00:02, 15.05it/s]\n 62%|██████▏ | 62/100 [00:04<00:02, 15.12it/s]\n 64%|██████▍ | 64/100 [00:04<00:02, 15.25it/s]\n 66%|██████▌ | 66/100 [00:04<00:02, 15.39it/s]\n 68%|██████▊ | 68/100 [00:04<00:02, 15.39it/s]\n 70%|███████ | 70/100 [00:04<00:01, 15.48it/s]\n 72%|███████▏ | 72/100 [00:04<00:01, 15.60it/s]\n 74%|███████▍ | 74/100 [00:05<00:01, 15.86it/s]\n 76%|███████▌ | 76/100 [00:05<00:01, 15.79it/s]\n 78%|███████▊ | 78/100 [00:05<00:01, 15.65it/s]\n 80%|████████ | 80/100 [00:05<00:01, 15.12it/s]\n 82%|████████▏ | 82/100 [00:05<00:01, 15.35it/s]\n 84%|████████▍ | 84/100 [00:05<00:01, 15.28it/s]\n 86%|████████▌ | 86/100 [00:05<00:00, 15.38it/s]\n 88%|████████▊ | 88/100 [00:05<00:00, 15.53it/s]\n 90%|█████████ | 90/100 [00:06<00:00, 15.26it/s]\n 92%|█████████▏| 92/100 [00:06<00:00, 14.85it/s]\n 94%|█████████▍| 94/100 [00:06<00:00, 14.59it/s]\n 96%|█████████▌| 96/100 [00:06<00:00, 14.70it/s]\n 98%|█████████▊| 98/100 [00:06<00:00, 14.25it/s]\n100%|██████████| 100/100 [00:06<00:00, 14.10it/s]\n100%|██████████| 100/100 [00:06<00:00, 14.61it/s]",
"output": [
"https://replicate.delivery/pbxt/kfL8fyBkHllh4kfEJbulrcnzWywUzZ2Fl1GkpXlb4n8xiaugA/out-0.png"
],
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2023-01-24T00:12:01.075581Z",
"started_at": "2023-01-24T00:12:01.128892Z",
"completed_at": "2023-01-24T00:12:09.33802Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/j5myyosmjbcpjcqesowun6idie/cancel",
"get": "https://api.replicate.com/v1/predictions/j5myyosmjbcpjcqesowun6idie"
},
"metrics": {
"predict_time": 8.209128,
"total_time": 8.262439
}
}
