defaulttext2img
typeenum
value typestring
optionstext2img, text_guided_img2img
{
"guidance_scale": 1,
"height": 768,
"negative_prompt": "low quality, bad quality",
"num_inference_steps": 100,
"num_outputs": 1,
"num_steps_prior": 25,
"prompt": "A alien cheeseburger creature eating itself, claymation, cinematic, moody lighting",
"strength": 0.3,
"task": "text2img",
"width": 768
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_6mZ**********************************
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 ai-forever/kandinsky-2-1 using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const output = await replicate.run(
"ai-forever/kandinsky-2-1:a768f3c2e174c54b576cc4f222e789e161160403d0cd0ace41eeb9a0f8c8d5f8",
{
input: {
guidance_scale: 1,
height: 768,
negative_prompt: "low quality, bad quality",
num_inference_steps: 100,
num_outputs: 1,
num_steps_prior: 25,
prompt: "A alien cheeseburger creature eating itself, claymation, cinematic, moody lighting",
strength: 0.3,
task: "text2img",
width: 768
}
}
);
// 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_6mZ**********************************
This is your API token. Keep it to yourself.
import replicate
Run ai-forever/kandinsky-2-1 using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"ai-forever/kandinsky-2-1:a768f3c2e174c54b576cc4f222e789e161160403d0cd0ace41eeb9a0f8c8d5f8",
input={
"guidance_scale": 1,
"height": 768,
"negative_prompt": "low quality, bad quality",
"num_inference_steps": 100,
"num_outputs": 1,
"num_steps_prior": 25,
"prompt": "A alien cheeseburger creature eating itself, claymation, cinematic, moody lighting",
"strength": 0.3,
"task": "text2img",
"width": 768
}
)
# 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_6mZ**********************************
This is your API token. Keep it to yourself.
Run ai-forever/kandinsky-2-1 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": "ai-forever/kandinsky-2-1:a768f3c2e174c54b576cc4f222e789e161160403d0cd0ace41eeb9a0f8c8d5f8",
"input": {
"guidance_scale": 1,
"height": 768,
"negative_prompt": "low quality, bad quality",
"num_inference_steps": 100,
"num_outputs": 1,
"num_steps_prior": 25,
"prompt": "A alien cheeseburger creature eating itself, claymation, cinematic, moody lighting",
"strength": 0.3,
"task": "text2img",
"width": 768
}
}' \
https://api.replicate.com/v1/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
{
"id": "ryhrl4slzbd3jhxtz5ar5nd24u",
"model": "ai-forever/kandinsky-2-1",
"version": "a768f3c2e174c54b576cc4f222e789e161160403d0cd0ace41eeb9a0f8c8d5f8",
"input": {
"guidance_scale": 1,
"height": 768,
"negative_prompt": "low quality, bad quality",
"num_inference_steps": 100,
"num_outputs": 1,
"num_steps_prior": 25,
"prompt": "A alien cheeseburger creature eating itself, claymation, cinematic, moody lighting",
"strength": 0.3,
"task": "text2img",
"width": 768
},
"logs": "Using seed: 9578\n 0%| | 0/25 [00:00<?, ?it/s]\n 20%|██ | 5/25 [00:00<00:00, 45.87it/s]\n 40%|████ | 10/25 [00:00<00:00, 46.46it/s]\n 60%|██████ | 15/25 [00:00<00:00, 44.90it/s]\n 80%|████████ | 20/25 [00:00<00:00, 46.28it/s]\n100%|██████████| 25/25 [00:00<00:00, 47.07it/s]\n100%|██████████| 25/25 [00:00<00:00, 46.49it/s]\n 0%| | 0/100 [00:00<?, ?it/s]\n 2%|▏ | 2/100 [00:00<00:06, 15.23it/s]\n 4%|▍ | 4/100 [00:00<00:06, 15.72it/s]\n 6%|▌ | 6/100 [00:00<00:05, 16.19it/s]\n 8%|▊ | 8/100 [00:00<00:05, 16.23it/s]\n 10%|█ | 10/100 [00:00<00:05, 16.41it/s]\n 12%|█▏ | 12/100 [00:00<00:05, 16.39it/s]\n 14%|█▍ | 14/100 [00:00<00:05, 16.24it/s]\n 16%|█▌ | 16/100 [00:00<00:05, 16.33it/s]\n 18%|█▊ | 18/100 [00:01<00:05, 16.17it/s]\n 20%|██ | 20/100 [00:01<00:04, 16.32it/s]\n 22%|██▏ | 22/100 [00:01<00:04, 16.41it/s]\n 24%|██▍ | 24/100 [00:01<00:04, 16.50it/s]\n 26%|██▌ | 26/100 [00:01<00:04, 16.57it/s]\n 28%|██▊ | 28/100 [00:01<00:04, 16.57it/s]\n 30%|███ | 30/100 [00:01<00:04, 16.53it/s]\n 32%|███▏ | 32/100 [00:01<00:04, 16.60it/s]\n 34%|███▍ | 34/100 [00:02<00:04, 16.42it/s]\n 36%|███▌ | 36/100 [00:02<00:03, 16.50it/s]\n 38%|███▊ | 38/100 [00:02<00:03, 16.48it/s]\n 40%|████ | 40/100 [00:02<00:03, 16.51it/s]\n 42%|████▏ | 42/100 [00:02<00:03, 16.55it/s]\n 44%|████▍ | 44/100 [00:02<00:03, 16.48it/s]\n 46%|████▌ | 46/100 [00:02<00:03, 16.49it/s]\n 48%|████▊ | 48/100 [00:02<00:03, 16.54it/s]\n 50%|█████ | 50/100 [00:03<00:03, 16.43it/s]\n 52%|█████▏ | 52/100 [00:03<00:02, 16.45it/s]\n 54%|█████▍ | 54/100 [00:03<00:02, 16.34it/s]\n 56%|█████▌ | 56/100 [00:03<00:02, 16.40it/s]\n 58%|█████▊ | 58/100 [00:03<00:02, 16.42it/s]\n 60%|██████ | 60/100 [00:03<00:02, 16.48it/s]\n 62%|██████▏ | 62/100 [00:03<00:02, 16.49it/s]\n 64%|██████▍ | 64/100 [00:03<00:02, 16.51it/s]\n 66%|██████▌ | 66/100 [00:04<00:02, 16.48it/s]\n 68%|██████▊ | 68/100 [00:04<00:01, 16.40it/s]\n 70%|███████ | 70/100 [00:04<00:01, 16.45it/s]\n 72%|███████▏ | 72/100 [00:04<00:01, 16.55it/s]\n 74%|███████▍ | 74/100 [00:04<00:01, 16.63it/s]\n 76%|███████▌ | 76/100 [00:04<00:01, 16.70it/s]\n 78%|███████▊ | 78/100 [00:04<00:01, 16.60it/s]\n 80%|████████ | 80/100 [00:04<00:01, 16.59it/s]\n 82%|████████▏ | 82/100 [00:04<00:01, 16.69it/s]\n 84%|████████▍ | 84/100 [00:05<00:00, 16.68it/s]\n 86%|████████▌ | 86/100 [00:05<00:00, 16.74it/s]\n 88%|████████▊ | 88/100 [00:05<00:00, 16.77it/s]\n 90%|█████████ | 90/100 [00:05<00:00, 16.46it/s]\n 92%|█████████▏| 92/100 [00:05<00:00, 16.58it/s]\n 94%|█████████▍| 94/100 [00:05<00:00, 16.55it/s]\n 96%|█████████▌| 96/100 [00:05<00:00, 16.65it/s]\n 98%|█████████▊| 98/100 [00:05<00:00, 16.67it/s]\n100%|██████████| 100/100 [00:06<00:00, 16.63it/s]\n100%|██████████| 100/100 [00:06<00:00, 16.49it/s]",
"output": [
"https://replicate.delivery/pbxt/aOZ4ywUeyeiyqEz5l7lixq0e5rAbs3qTStetOGXNKZd4g6QEB/out-0.png"
],
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2023-06-09T14:32:39.014305Z",
"started_at": "2023-06-09T14:32:38.982333Z",
"completed_at": "2023-06-09T14:32:46.808598Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/ryhrl4slzbd3jhxtz5ar5nd24u/cancel",
"get": "https://api.replicate.com/v1/predictions/ryhrl4slzbd3jhxtz5ar5nd24u"
},
"metrics": {
"predict_time": 7.826265,
"total_time": 7.794293
}
}