typetext
{
"aspect_ratio": "1:1",
"guidance": 3.5,
"num_inference_steps": 28,
"num_outputs": 1,
"output_format": "webp",
"output_quality": 80,
"prompt": "latina model",
"prompt_strength": 0.8
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_1IC**********************************
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 black-forest-labs/flux-dev using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const input = {
aspect_ratio: "1:1",
guidance: 3.5,
num_inference_steps: 28,
num_outputs: 1,
output_format: "webp",
output_quality: 80,
prompt: "latina model",
prompt_strength: 0.8
};
const output = await replicate.run("black-forest-labs/flux-dev", { input });
// 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_1IC**********************************
This is your API token. Keep it to yourself.
import replicate
Run black-forest-labs/flux-dev using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"black-forest-labs/flux-dev",
input={
"aspect_ratio": "1:1",
"guidance": 3.5,
"num_inference_steps": 28,
"num_outputs": 1,
"output_format": "webp",
"output_quality": 80,
"prompt": "latina model",
"prompt_strength": 0.8
}
)
# 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_1IC**********************************
This is your API token. Keep it to yourself.
Run black-forest-labs/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 $'{
"input": {
"aspect_ratio": "1:1",
"guidance": 3.5,
"num_inference_steps": 28,
"num_outputs": 1,
"output_format": "webp",
"output_quality": 80,
"prompt": "latina model",
"prompt_strength": 0.8
}
}' \
https://api.replicate.com/v1/models/black-forest-labs/flux-dev/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
{
"id": "nbgkpy68m1rm40chr1faxpw2vg",
"model": "black-forest-labs/flux-dev",
"version": "hidden",
"input": {
"aspect_ratio": "1:1",
"guidance": 3.5,
"num_inference_steps": 28,
"num_outputs": 1,
"output_format": "webp",
"output_quality": 80,
"prompt": "latina model",
"prompt_strength": 0.8
},
"logs": "Using seed: 54017\n0it [00:00, ?it/s]\n2it [00:00, 13.73it/s]\n4it [00:00, 8.01it/s]\n5it [00:00, 7.38it/s]\n6it [00:00, 6.99it/s]\n7it [00:00, 6.49it/s]\n8it [00:01, 6.37it/s]\n9it [00:01, 6.31it/s]\n10it [00:01, 6.28it/s]\n11it [00:01, 6.26it/s]\n12it [00:01, 6.25it/s]\n13it [00:01, 6.11it/s]\n14it [00:02, 6.09it/s]\n15it [00:02, 6.09it/s]\n16it [00:02, 6.12it/s]\n17it [00:02, 6.16it/s]\n18it [00:02, 6.15it/s]\n19it [00:02, 6.09it/s]\n20it [00:03, 6.05it/s]\n21it [00:03, 6.07it/s]\n22it [00:03, 6.10it/s]\n23it [00:03, 6.11it/s]\n24it [00:03, 6.11it/s]\n25it [00:03, 6.09it/s]\n26it [00:04, 6.07it/s]\n27it [00:04, 6.08it/s]\n28it [00:04, 6.10it/s]\n28it [00:04, 6.35it/s]\nTotal safe images: 1 out of 1",
"output": [
"https://replicate.delivery/yhqm/0IJIfDzOLO05ciFy0ABzvgfmu19xw5g0Cp9WcOengNSoGczmA/out-0.webp"
],
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2024-09-05T04:08:42.912Z",
"started_at": "2024-09-05T04:08:47.907315Z",
"completed_at": "2024-09-05T04:08:52.95412Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/nbgkpy68m1rm40chr1faxpw2vg/cancel",
"get": "https://api.replicate.com/v1/predictions/nbgkpy68m1rm40chr1faxpw2vg",
"web": "https://replicate.com/p/nbgkpy68m1rm40chr1faxpw2vg"
},
"metrics": {
"image_count": 1,
"predict_time": 5.046805054,
"total_time": 10.04212
}
}