typefile
{
"aspect_ratio": "4:3",
"guidance": 3,
"megapixels": "1",
"num_inference_steps": 28,
"num_outputs": 1,
"output_format": "webp",
"output_quality": 80,
"redux_image": "https://replicate.delivery/pbxt/M0mdz2nXiUmhpfLswjNdEHT3IhGtclUz7Q1sCw3XiHXzUugT/0_ZjYSm_q36J4KChdn.webp"
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_4WQ**********************************
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-redux-dev using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const input = {
aspect_ratio: "4:3",
guidance: 3,
megapixels: "1",
num_inference_steps: 28,
num_outputs: 1,
output_format: "webp",
output_quality: 80,
redux_image: "https://replicate.delivery/pbxt/M0mdz2nXiUmhpfLswjNdEHT3IhGtclUz7Q1sCw3XiHXzUugT/0_ZjYSm_q36J4KChdn.webp"
};
const output = await replicate.run("black-forest-labs/flux-redux-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_4WQ**********************************
This is your API token. Keep it to yourself.
import replicate
Run black-forest-labs/flux-redux-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-redux-dev",
input={
"aspect_ratio": "4:3",
"guidance": 3,
"megapixels": "1",
"num_inference_steps": 28,
"num_outputs": 1,
"output_format": "webp",
"output_quality": 80,
"redux_image": "https://replicate.delivery/pbxt/M0mdz2nXiUmhpfLswjNdEHT3IhGtclUz7Q1sCw3XiHXzUugT/0_ZjYSm_q36J4KChdn.webp"
}
)
# 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_4WQ**********************************
This is your API token. Keep it to yourself.
Run black-forest-labs/flux-redux-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": "4:3",
"guidance": 3,
"megapixels": "1",
"num_inference_steps": 28,
"num_outputs": 1,
"output_format": "webp",
"output_quality": 80,
"redux_image": "https://replicate.delivery/pbxt/M0mdz2nXiUmhpfLswjNdEHT3IhGtclUz7Q1sCw3XiHXzUugT/0_ZjYSm_q36J4KChdn.webp"
}
}' \
https://api.replicate.com/v1/models/black-forest-labs/flux-redux-dev/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
{
"id": "syf1t20h0hrmc0ck9x8rbdjybc",
"model": "black-forest-labs/flux-redux-dev",
"version": "hidden",
"input": {
"aspect_ratio": "4:3",
"guidance": 3,
"megapixels": "1",
"num_inference_steps": 28,
"num_outputs": 1,
"output_format": "webp",
"output_quality": 80,
"redux_image": "https://replicate.delivery/pbxt/M0mdz2nXiUmhpfLswjNdEHT3IhGtclUz7Q1sCw3XiHXzUugT/0_ZjYSm_q36J4KChdn.webp"
},
"logs": "running bf16 model, fp8 disabled\nUsing seed: 61735\n0it [00:00, ?it/s]\n1it [00:00, 6.93it/s]\n2it [00:00, 4.80it/s]\n3it [00:00, 4.38it/s]\n4it [00:00, 4.18it/s]\n5it [00:01, 4.06it/s]\n6it [00:01, 4.02it/s]\n7it [00:01, 4.00it/s]\n8it [00:01, 3.97it/s]\n9it [00:02, 3.94it/s]\n10it [00:02, 3.93it/s]\n11it [00:02, 3.94it/s]\n12it [00:02, 3.93it/s]\n13it [00:03, 3.92it/s]\n14it [00:03, 3.92it/s]\n15it [00:03, 3.92it/s]\n16it [00:03, 3.92it/s]\n17it [00:04, 3.91it/s]\n18it [00:04, 3.92it/s]\n19it [00:04, 3.92it/s]\n20it [00:04, 3.91it/s]\n21it [00:05, 3.91it/s]\n22it [00:05, 3.91it/s]\n23it [00:05, 3.92it/s]\n24it [00:06, 3.92it/s]\n25it [00:06, 3.91it/s]\n26it [00:06, 3.92it/s]\n27it [00:06, 3.91it/s]\n28it [00:07, 3.91it/s]\n28it [00:07, 3.98it/s]\nTotal safe images: 1 out of 1",
"output": [
"https://replicate.delivery/xezq/Oaex1FdP2ayjUSrbBrYA1WXnGJlu2ESnk71anWxs4OGWEo5JA/out-0.webp"
],
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2024-11-21T15:22:13.124Z",
"started_at": "2024-11-21T15:22:13.13188Z",
"completed_at": "2024-11-21T15:22:20.654364Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/syf1t20h0hrmc0ck9x8rbdjybc/cancel",
"get": "https://api.replicate.com/v1/predictions/syf1t20h0hrmc0ck9x8rbdjybc",
"stream": "https://stream.replicate.com/v1/files/bcwr-oy3eifiybhx5ctwbbpkrx457d2pvmwzp47jsxxvfojeh6n4pu4fa",
"web": "https://replicate.com/p/syf1t20h0hrmc0ck9x8rbdjybc"
},
"metrics": {
"image_count": 1,
"predict_time": 7.522483329,
"total_time": 7.530364
}
}
