typetext
{
"guidance_scale": 7.5,
"height": "640",
"num_inference_steps": 50,
"num_outputs": 1,
"prompt": "anna wintour as a pirate",
"width": 640
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_YJz**********************************
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 andreasjansson/monkey-island-sd using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const output = await replicate.run(
"andreasjansson/monkey-island-sd:d4c14b78d93ea8a6537bf73a8c83af8cdb0c31795ff7ebaa91ff9a041b7077f9",
{
input: {
guidance_scale: 7.5,
height: "640",
num_inference_steps: 50,
num_outputs: 1,
prompt: "anna wintour as a pirate",
width: 640
}
}
);
// 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_YJz**********************************
This is your API token. Keep it to yourself.
import replicate
Run andreasjansson/monkey-island-sd using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"andreasjansson/monkey-island-sd:d4c14b78d93ea8a6537bf73a8c83af8cdb0c31795ff7ebaa91ff9a041b7077f9",
input={
"guidance_scale": 7.5,
"height": "640",
"num_inference_steps": 50,
"num_outputs": 1,
"prompt": "anna wintour as a pirate",
"width": 640
}
)
# 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_YJz**********************************
This is your API token. Keep it to yourself.
Run andreasjansson/monkey-island-sd 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": "andreasjansson/monkey-island-sd:d4c14b78d93ea8a6537bf73a8c83af8cdb0c31795ff7ebaa91ff9a041b7077f9",
"input": {
"guidance_scale": 7.5,
"height": "640",
"num_inference_steps": 50,
"num_outputs": 1,
"prompt": "anna wintour as a pirate",
"width": 640
}
}' \
https://api.replicate.com/v1/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
{
"id": "xj2af7ztarc7hnnqrdz4lexedm",
"model": "andreasjansson/monkey-island-sd",
"version": "d4c14b78d93ea8a6537bf73a8c83af8cdb0c31795ff7ebaa91ff9a041b7077f9",
"input": {
"guidance_scale": 7.5,
"height": "640",
"num_inference_steps": 50,
"num_outputs": 1,
"prompt": "anna wintour as a pirate",
"width": 640
},
"logs": "Using seed: 10159\n\n 0%| | 0/51 [00:00<?, ?it/s]\n 4%|▍ | 2/51 [00:00<00:03, 12.30it/s]\n 8%|▊ | 4/51 [00:00<00:03, 13.69it/s]\n 12%|█▏ | 6/51 [00:00<00:03, 13.70it/s]\n 16%|█▌ | 8/51 [00:00<00:03, 13.60it/s]\n 20%|█▉ | 10/51 [00:00<00:02, 13.84it/s]\n 24%|██▎ | 12/51 [00:00<00:02, 14.77it/s]\n 27%|██▋ | 14/51 [00:00<00:02, 15.33it/s]\n 31%|███▏ | 16/51 [00:01<00:02, 15.72it/s]\n 35%|███▌ | 18/51 [00:01<00:02, 16.02it/s]\n 39%|███▉ | 20/51 [00:01<00:01, 16.35it/s]\n 43%|████▎ | 22/51 [00:01<00:01, 16.58it/s]\n 47%|████▋ | 24/51 [00:01<00:01, 16.73it/s]\n 51%|█████ | 26/51 [00:01<00:01, 16.86it/s]\n 55%|█████▍ | 28/51 [00:01<00:01, 16.95it/s]\n 59%|█████▉ | 30/51 [00:01<00:01, 17.01it/s]\n 63%|██████▎ | 32/51 [00:02<00:01, 16.55it/s]\n 67%|██████▋ | 34/51 [00:02<00:01, 16.61it/s]\n 71%|███████ | 36/51 [00:02<00:00, 16.09it/s]\n 75%|███████▍ | 38/51 [00:02<00:00, 15.31it/s]\n 78%|███████▊ | 40/51 [00:02<00:00, 14.92it/s]\n 82%|████████▏ | 42/51 [00:02<00:00, 15.52it/s]\n 86%|████████▋ | 44/51 [00:02<00:00, 15.84it/s]\n 90%|█████████ | 46/51 [00:02<00:00, 16.23it/s]\n 94%|█████████▍| 48/51 [00:03<00:00, 16.52it/s]\n 98%|█████████▊| 50/51 [00:03<00:00, 16.63it/s]\n100%|██████████| 51/51 [00:03<00:00, 15.82it/s]",
"output": [
"https://replicate.delivery/pbxt/fKrVSppVibyzXSB69yTGUPwkQ43cx8jfRp3lQHHKfUL93r3fA/out-0.png"
],
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2022-11-01T23:34:18.672178Z",
"started_at": "2022-11-01T23:34:18.739418Z",
"completed_at": "2022-11-01T23:34:22.253222Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/xj2af7ztarc7hnnqrdz4lexedm/cancel",
"get": "https://api.replicate.com/v1/predictions/xj2af7ztarc7hnnqrdz4lexedm"
},
"metrics": {
"predict_time": 3.513804,
"total_time": 3.581044
}
}