typetext
{
"aspect_ratio": "1:1",
"guidance_scale": 3.5,
"num_inference_steps": 8,
"num_outputs": 1,
"output_format": "webp",
"output_quality": 80,
"prompt": "a light bulb, instead of the usual filament, there's a small sailboat with its sails unfurled. The sailboat is illuminated from within, suggesting it's powered by the light bulb itself. The bulb is suspended against a cosmic backdrop filled with stars, giving the impression that the sailboat is sailing through space"
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_XNR**********************************
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 lucataco/flux.1-turbo-alpha using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const output = await replicate.run(
"lucataco/flux.1-turbo-alpha:0a1455f62355121add4f2a90e7cc3cbc3343359c2852f321da7660c101047915",
{
input: {
aspect_ratio: "1:1",
guidance_scale: 3.5,
num_inference_steps: 8,
num_outputs: 1,
output_format: "webp",
output_quality: 80,
prompt: "a light bulb, instead of the usual filament, there's a small sailboat with its sails unfurled. The sailboat is illuminated from within, suggesting it's powered by the light bulb itself. The bulb is suspended against a cosmic backdrop filled with stars, giving the impression that the sailboat is sailing through space"
}
}
);
// 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_XNR**********************************
This is your API token. Keep it to yourself.
import replicate
Run lucataco/flux.1-turbo-alpha using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"lucataco/flux.1-turbo-alpha:0a1455f62355121add4f2a90e7cc3cbc3343359c2852f321da7660c101047915",
input={
"aspect_ratio": "1:1",
"guidance_scale": 3.5,
"num_inference_steps": 8,
"num_outputs": 1,
"output_format": "webp",
"output_quality": 80,
"prompt": "a light bulb, instead of the usual filament, there's a small sailboat with its sails unfurled. The sailboat is illuminated from within, suggesting it's powered by the light bulb itself. The bulb is suspended against a cosmic backdrop filled with stars, giving the impression that the sailboat is sailing through space"
}
)
# 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_XNR**********************************
This is your API token. Keep it to yourself.
Run lucataco/flux.1-turbo-alpha 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": "lucataco/flux.1-turbo-alpha:0a1455f62355121add4f2a90e7cc3cbc3343359c2852f321da7660c101047915",
"input": {
"aspect_ratio": "1:1",
"guidance_scale": 3.5,
"num_inference_steps": 8,
"num_outputs": 1,
"output_format": "webp",
"output_quality": 80,
"prompt": "a light bulb, instead of the usual filament, there\'s a small sailboat with its sails unfurled. The sailboat is illuminated from within, suggesting it\'s powered by the light bulb itself. The bulb is suspended against a cosmic backdrop filled with stars, giving the impression that the sailboat is sailing through space"
}
}' \
https://api.replicate.com/v1/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
{
"id": "rqc525eam9rj60cjjdtr7w31cw",
"model": "lucataco/flux.1-turbo-alpha",
"version": "0a1455f62355121add4f2a90e7cc3cbc3343359c2852f321da7660c101047915",
"input": {
"aspect_ratio": "1:1",
"guidance_scale": 3.5,
"num_inference_steps": 8,
"num_outputs": 1,
"output_format": "webp",
"output_quality": 80,
"prompt": "a light bulb, instead of the usual filament, there's a small sailboat with its sails unfurled. The sailboat is illuminated from within, suggesting it's powered by the light bulb itself. The bulb is suspended against a cosmic backdrop filled with stars, giving the impression that the sailboat is sailing through space"
},
"logs": "Using seed: 21537\nPrompt: a light bulb, instead of the usual filament, there's a small sailboat with its sails unfurled. The sailboat is illuminated from within, suggesting it's powered by the light bulb itself. The bulb is suspended against a cosmic backdrop filled with stars, giving the impression that the sailboat is sailing through space\ntxt2img mode\n 0%| | 0/8 [00:00<?, ?it/s]\n 12%|█▎ | 1/8 [00:00<00:03, 2.20it/s]\n 25%|██▌ | 2/8 [00:00<00:02, 2.89it/s]\n 38%|███▊ | 3/8 [00:01<00:01, 2.52it/s]\n 50%|█████ | 4/8 [00:01<00:01, 2.38it/s]\n 62%|██████▎ | 5/8 [00:02<00:01, 2.31it/s]\n 75%|███████▌ | 6/8 [00:02<00:00, 2.27it/s]\n 88%|████████▊ | 7/8 [00:03<00:00, 2.24it/s]\n100%|██████████| 8/8 [00:03<00:00, 2.23it/s]\n100%|██████████| 8/8 [00:03<00:00, 2.31it/s]",
"output": [
"https://replicate.delivery/yhqm/q9DhObZXYwqhLVD7TVueOsLGzTkXn8KiJlJXu56MNG5lVnzJA/out-0.webp"
],
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2024-10-16T03:53:43.33Z",
"started_at": "2024-10-16T03:53:43.341157Z",
"completed_at": "2024-10-16T03:53:47.326944Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/rqc525eam9rj60cjjdtr7w31cw/cancel",
"get": "https://api.replicate.com/v1/predictions/rqc525eam9rj60cjjdtr7w31cw",
"web": "https://replicate.com/p/rqc525eam9rj60cjjdtr7w31cw"
},
"metrics": {
"predict_time": 3.985786937,
"total_time": 3.996944
}
}