typetext
{
"prompt": "A portrait of a bust in a tree in an abandoned library ruin, the roof fallen in, sunbeams streaming through the dusty air. A tree grows in the center, among disheveled books, with a statue of a head made of gold nestled in the fork of its branches. The statue looks knowingly toward the camera with an inscrutable expression. Green leafy vines and colorful flowers grow from the top of its head like hair. In the foreground, an open page reads \"WELCOME TO THE DEEP FATES PROGRAM\"",
"size": "1024x1024",
"style": "realistic_image/studio_portrait"
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_f0Q**********************************
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 recraft-ai/recraft-v3 using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const input = {
prompt: "A portrait of a bust in a tree in an abandoned library ruin, the roof fallen in, sunbeams streaming through the dusty air. A tree grows in the center, among disheveled books, with a statue of a head made of gold nestled in the fork of its branches. The statue looks knowingly toward the camera with an inscrutable expression. Green leafy vines and colorful flowers grow from the top of its head like hair. In the foreground, an open page reads \"WELCOME TO THE DEEP FATES PROGRAM\"",
size: "1024x1024",
style: "realistic_image/studio_portrait"
};
const output = await replicate.run("recraft-ai/recraft-v3", { input });
// To access the file URL:
console.log(output.url()); //=> "http://example.com"
// To write the file to disk:
fs.writeFile("my-image.png", output);
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_f0Q**********************************
This is your API token. Keep it to yourself.
import replicate
Run recraft-ai/recraft-v3 using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"recraft-ai/recraft-v3",
input={
"prompt": "A portrait of a bust in a tree in an abandoned library ruin, the roof fallen in, sunbeams streaming through the dusty air. A tree grows in the center, among disheveled books, with a statue of a head made of gold nestled in the fork of its branches. The statue looks knowingly toward the camera with an inscrutable expression. Green leafy vines and colorful flowers grow from the top of its head like hair. In the foreground, an open page reads \"WELCOME TO THE DEEP FATES PROGRAM\"",
"size": "1024x1024",
"style": "realistic_image/studio_portrait"
}
)
# To access the file URL:
print(output.url())
#=> "http://example.com"
# To write the file to disk:
with open("my-image.png", "wb") as file:
file.write(output.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_f0Q**********************************
This is your API token. Keep it to yourself.
Run recraft-ai/recraft-v3 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 $'{
"input": {
"prompt": "A portrait of a bust in a tree in an abandoned library ruin, the roof fallen in, sunbeams streaming through the dusty air. A tree grows in the center, among disheveled books, with a statue of a head made of gold nestled in the fork of its branches. The statue looks knowingly toward the camera with an inscrutable expression. Green leafy vines and colorful flowers grow from the top of its head like hair. In the foreground, an open page reads \\"WELCOME TO THE DEEP FATES PROGRAM\\"",
"size": "1024x1024",
"style": "realistic_image/studio_portrait"
}
}' \
https://api.replicate.com/v1/models/recraft-ai/recraft-v3/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
{
"id": "6vkeryq51drge0cjvxz9y8vypw",
"model": "recraft-ai/recraft-v3",
"version": "hidden",
"input": {
"prompt": "A portrait of a bust in a tree in an abandoned library ruin, the roof fallen in, sunbeams streaming through the dusty air. A tree grows in the center, among disheveled books, with a statue of a head made of gold nestled in the fork of its branches. The statue looks knowingly toward the camera with an inscrutable expression. Green leafy vines and colorful flowers grow from the top of its head like hair. In the foreground, an open page reads \"WELCOME TO THE DEEP FATES PROGRAM\"",
"size": "1024x1024",
"style": "realistic_image/studio_portrait"
},
"logs": "Running prediction... \nStarting image generation...\nGenerated image in 15.59sec",
"output": "https://replicate.delivery/czjl/TwfBrkZQLWRzBCAYGTybeX657ooFNLkVNX1i6baFxrvoHGsTA/output.webp",
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2024-10-30T22:14:48.331Z",
"started_at": "2024-10-30T22:14:48.339037Z",
"completed_at": "2024-10-30T22:15:04.209305Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/6vkeryq51drge0cjvxz9y8vypw/cancel",
"get": "https://api.replicate.com/v1/predictions/6vkeryq51drge0cjvxz9y8vypw",
"stream": "https://stream.replicate.com/v1/files/fddq-emnzpzcmkyefz5ghgmyq2kg6hgqlhr35qz57kwdndmllgwzg6dwq",
"web": "https://replicate.com/p/6vkeryq51drge0cjvxz9y8vypw"
},
"metrics": {
"image_count": 1,
"predict_time": 15.870268141,
"total_time": 15.878305
}
}