typetext
{
"aspect_ratio": "1:1",
"guidance_scale": 3.5,
"num_inference_steps": 28,
"num_outputs": 1,
"output_format": "webp",
"output_quality": 80,
"prompt": "a tiny astronaut hatching from an egg on the moon"
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_Lh9**********************************
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-dev using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const output = await replicate.run(
"lucataco/flux-dev:928ef162a66d974807e8d755d03e1eaabebba844b7c1ab0a16a91ad6fd077ab0",
{
input: {
aspect_ratio: "1:1",
guidance_scale: 3.5,
num_inference_steps: 28,
num_outputs: 1,
output_format: "webp",
output_quality: 80,
prompt: "a tiny astronaut hatching from an egg on the moon"
}
}
);
// 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_Lh9**********************************
This is your API token. Keep it to yourself.
import replicate
Run lucataco/flux-dev using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"lucataco/flux-dev:928ef162a66d974807e8d755d03e1eaabebba844b7c1ab0a16a91ad6fd077ab0",
input={
"aspect_ratio": "1:1",
"guidance_scale": 3.5,
"num_inference_steps": 28,
"num_outputs": 1,
"output_format": "webp",
"output_quality": 80,
"prompt": "a tiny astronaut hatching from an egg on the moon"
}
)
# 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_Lh9**********************************
This is your API token. Keep it to yourself.
Run lucataco/flux-dev 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-dev:928ef162a66d974807e8d755d03e1eaabebba844b7c1ab0a16a91ad6fd077ab0",
"input": {
"aspect_ratio": "1:1",
"guidance_scale": 3.5,
"num_inference_steps": 28,
"num_outputs": 1,
"output_format": "webp",
"output_quality": 80,
"prompt": "a tiny astronaut hatching from an egg on the moon"
}
}' \
https://api.replicate.com/v1/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
{
"id": "jjmfcss6qsrme0cm1wptck3fk8",
"model": "lucataco/flux-dev",
"version": "928ef162a66d974807e8d755d03e1eaabebba844b7c1ab0a16a91ad6fd077ab0",
"input": {
"aspect_ratio": "1:1",
"guidance_scale": 3.5,
"num_inference_steps": 28,
"num_outputs": 1,
"output_format": "webp",
"output_quality": 80,
"prompt": "a tiny astronaut hatching from an egg on the moon"
},
"logs": "Using seed: 18227\nPrompt: a tiny astronaut hatching from an egg on the moon\ntxt2img mode\n 0%| | 0/28 [00:00<?, ?it/s]\n 4%|▎ | 1/28 [00:00<00:05, 4.56it/s]\n 7%|▋ | 2/28 [00:00<00:04, 5.80it/s]\n 11%|█ | 3/28 [00:00<00:04, 5.16it/s]\n 14%|█▍ | 4/28 [00:00<00:04, 4.91it/s]\n 18%|█▊ | 5/28 [00:01<00:04, 4.73it/s]\n 21%|██▏ | 6/28 [00:01<00:04, 4.65it/s]\n 25%|██▌ | 7/28 [00:01<00:04, 4.61it/s]\n 29%|██▊ | 8/28 [00:01<00:04, 4.59it/s]\n 32%|███▏ | 9/28 [00:01<00:04, 4.58it/s]\n 36%|███▌ | 10/28 [00:02<00:03, 4.55it/s]\n 39%|███▉ | 11/28 [00:02<00:03, 4.55it/s]\n 43%|████▎ | 12/28 [00:02<00:03, 4.55it/s]\n 46%|████▋ | 13/28 [00:02<00:03, 4.55it/s]\n 50%|█████ | 14/28 [00:03<00:03, 4.53it/s]\n 54%|█████▎ | 15/28 [00:03<00:02, 4.52it/s]\n 57%|█████▋ | 16/28 [00:03<00:02, 4.53it/s]\n 61%|██████ | 17/28 [00:03<00:02, 4.54it/s]\n 64%|██████▍ | 18/28 [00:03<00:02, 4.54it/s]\n 68%|██████▊ | 19/28 [00:04<00:01, 4.53it/s]\n 71%|███████▏ | 20/28 [00:04<00:01, 4.53it/s]\n 75%|███████▌ | 21/28 [00:04<00:01, 4.52it/s]\n 79%|███████▊ | 22/28 [00:04<00:01, 4.52it/s]\n 82%|████████▏ | 23/28 [00:04<00:01, 4.52it/s]\n 86%|████████▌ | 24/28 [00:05<00:00, 4.52it/s]\n 89%|████████▉ | 25/28 [00:05<00:00, 4.52it/s]\n 93%|█████████▎| 26/28 [00:05<00:00, 4.52it/s]\n 96%|█████████▋| 27/28 [00:05<00:00, 4.53it/s]\n100%|██████████| 28/28 [00:06<00:00, 4.52it/s]\n100%|██████████| 28/28 [00:06<00:00, 4.59it/s]",
"output": [
"https://replicate.delivery/xezq/U8vYyyCnJ0YvIViDFxyfgMUfsHVYS5rmGVVzRJNW2fPHfHefE/out-0.webp"
],
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2024-12-28T21:30:04.862Z",
"started_at": "2024-12-28T21:30:04.868559Z",
"completed_at": "2024-12-28T21:30:11.277167Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/jjmfcss6qsrme0cm1wptck3fk8/cancel",
"get": "https://api.replicate.com/v1/predictions/jjmfcss6qsrme0cm1wptck3fk8",
"stream": "https://stream.replicate.com/v1/files/bcwr-eoel4sikdmu5wjc4x476x3re755n5gkm4heklhwuzbvhyp6gturq",
"web": "https://replicate.com/p/jjmfcss6qsrme0cm1wptck3fk8"
},
"metrics": {
"predict_time": 6.408607472,
"total_time": 6.415167
}
}