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/M0m98JONwoL6KpNLCXI3t87uFlrOmaqiTJmAOr4nFe9dbKs0/IMG_2270.jpg"
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_5aa**********************************
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/M0m98JONwoL6KpNLCXI3t87uFlrOmaqiTJmAOr4nFe9dbKs0/IMG_2270.jpg"
};
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_5aa**********************************
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/M0m98JONwoL6KpNLCXI3t87uFlrOmaqiTJmAOr4nFe9dbKs0/IMG_2270.jpg"
}
)
# 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_5aa**********************************
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/M0m98JONwoL6KpNLCXI3t87uFlrOmaqiTJmAOr4nFe9dbKs0/IMG_2270.jpg"
}
}' \
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": "1ev4dm8tvsrmc0ck9wvrcwddcr",
"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/M0m98JONwoL6KpNLCXI3t87uFlrOmaqiTJmAOr4nFe9dbKs0/IMG_2270.jpg"
},
"logs": "running bf16 model, fp8 disabled\nUsing seed: 31543\n0it [00:00, ?it/s]\n1it [00:00, 6.87it/s]\n2it [00:00, 4.77it/s]\n3it [00:00, 4.35it/s]\n4it [00:00, 4.16it/s]\n5it [00:01, 4.05it/s]\n6it [00:01, 4.00it/s]\n7it [00:01, 3.97it/s]\n8it [00:01, 3.95it/s]\n9it [00:02, 3.93it/s]\n10it [00:02, 3.92it/s]\n11it [00:02, 3.92it/s]\n12it [00:02, 3.92it/s]\n13it [00:03, 3.91it/s]\n14it [00:03, 3.91it/s]\n15it [00:03, 3.92it/s]\n16it [00:03, 3.91it/s]\n17it [00:04, 3.90it/s]\n18it [00:04, 3.90it/s]\n19it [00:04, 3.91it/s]\n20it [00:05, 3.91it/s]\n21it [00:05, 3.90it/s]\n22it [00:05, 3.90it/s]\n23it [00:05, 3.90it/s]\n24it [00:06, 3.90it/s]\n25it [00:06, 3.90it/s]\n26it [00:06, 3.90it/s]\n27it [00:06, 3.90it/s]\n28it [00:07, 3.90it/s]\n28it [00:07, 3.96it/s]\nTotal safe images: 1 out of 1",
"output": [
"https://replicate.delivery/xezq/OsN0ztnwTu6mMFH8nQXOzt0sS3bfVF2Mrv5m7vD57NPL3n5JA/out-0.webp"
],
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2024-11-21T14:53:51.71Z",
"started_at": "2024-11-21T14:54:06.440088Z",
"completed_at": "2024-11-21T14:54:14.860818Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/1ev4dm8tvsrmc0ck9wvrcwddcr/cancel",
"get": "https://api.replicate.com/v1/predictions/1ev4dm8tvsrmc0ck9wvrcwddcr",
"stream": "https://stream.replicate.com/v1/files/bcwr-kgblqrspbgzglk2bfi3enc7tck7iwiei7yvlayc25kb3xj47v3bq",
"web": "https://replicate.com/p/1ev4dm8tvsrmc0ck9wvrcwddcr"
},
"metrics": {
"image_count": 1,
"predict_time": 8.420730189,
"total_time": 23.150818
}
}
