typetext
{
"aspect_ratio": "1:1",
"go_fast": true,
"guidance": 3,
"lora_scale": 0.9,
"lora_weights": "huggingface.co/alvdansen/flux-koda",
"megapixels": "1",
"num_inference_steps": 28,
"num_outputs": 1,
"output_format": "webp",
"output_quality": 80,
"prompt": "A tabby cat lounging on a sun-dappled windowsill, half its body in shadow, half in bright light, flmft style",
"prompt_strength": 0.8
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_DZD**********************************
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-lora using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const input = {
aspect_ratio: "1:1",
go_fast: true,
guidance: 3,
lora_scale: 0.9,
lora_weights: "huggingface.co/alvdansen/flux-koda",
megapixels: "1",
num_inference_steps: 28,
num_outputs: 1,
output_format: "webp",
output_quality: 80,
prompt: "A tabby cat lounging on a sun-dappled windowsill, half its body in shadow, half in bright light, flmft style",
prompt_strength: 0.8
};
const output = await replicate.run("black-forest-labs/flux-dev-lora", { 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_DZD**********************************
This is your API token. Keep it to yourself.
import replicate
Run black-forest-labs/flux-dev-lora 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-lora",
input={
"aspect_ratio": "1:1",
"go_fast": True,
"guidance": 3,
"lora_scale": 0.9,
"lora_weights": "huggingface.co/alvdansen/flux-koda",
"megapixels": "1",
"num_inference_steps": 28,
"num_outputs": 1,
"output_format": "webp",
"output_quality": 80,
"prompt": "A tabby cat lounging on a sun-dappled windowsill, half its body in shadow, half in bright light, flmft style",
"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_DZD**********************************
This is your API token. Keep it to yourself.
Run black-forest-labs/flux-dev-lora 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",
"go_fast": true,
"guidance": 3,
"lora_scale": 0.9,
"lora_weights": "huggingface.co/alvdansen/flux-koda",
"megapixels": "1",
"num_inference_steps": 28,
"num_outputs": 1,
"output_format": "webp",
"output_quality": 80,
"prompt": "A tabby cat lounging on a sun-dappled windowsill, half its body in shadow, half in bright light, flmft style",
"prompt_strength": 0.8
}
}' \
https://api.replicate.com/v1/models/black-forest-labs/flux-dev-lora/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
{
"id": "55tgxa28qxrm80ck50996j6yzg",
"model": "black-forest-labs/flux-dev-lora",
"version": "hidden",
"input": {
"aspect_ratio": "1:1",
"go_fast": true,
"guidance": 3,
"lora_scale": 0.9,
"lora_weights": "huggingface.co/alvdansen/flux-koda",
"megapixels": "1",
"num_inference_steps": 28,
"num_outputs": 1,
"output_format": "webp",
"output_quality": 80,
"prompt": "A tabby cat lounging on a sun-dappled windowsill, half its body in shadow, half in bright light, flmft style",
"prompt_strength": 0.8
},
"logs": "2024-11-14 00:28:27.205 | DEBUG | fp8.lora_loading:apply_lora_to_model:547 - Extracting keys\n2024-11-14 00:28:27.205 | DEBUG | fp8.lora_loading:apply_lora_to_model:554 - Keys extracted\nApplying LoRA: 0%| | 0/304 [00:00<?, ?it/s]\nApplying LoRA: 100%|██████████| 304/304 [00:00<00:00, 13354.16it/s]\n2024-11-14 00:28:27.228 | SUCCESS | fp8.lora_loading:unload_loras:537 - LoRAs unloaded in 0.023s\n2024-11-14 00:28:27.231 | INFO | fp8.lora_loading:load_lora:497 - Loading LoRA weights for /src/weights-cache/31eaaa0241aa1ad5\n2024-11-14 00:28:27.384 | INFO | fp8.lora_loading:load_lora:518 - LoRA weights loaded\n2024-11-14 00:28:27.384 | DEBUG | fp8.lora_loading:apply_lora_to_model:547 - Extracting keys\n2024-11-14 00:28:27.384 | DEBUG | fp8.lora_loading:apply_lora_to_model:554 - Keys extracted\nApplying LoRA: 0%| | 0/304 [00:00<?, ?it/s]\nApplying LoRA: 41%|████ | 125/304 [00:00<00:00, 1248.30it/s]\nApplying LoRA: 82%|████████▏ | 250/304 [00:00<00:00, 954.60it/s] \nApplying LoRA: 100%|██████████| 304/304 [00:00<00:00, 967.09it/s]\n2024-11-14 00:28:27.699 | SUCCESS | fp8.lora_loading:load_lora:521 - LoRA applied in 0.47s\nrunning quantized prediction\nUsing seed: 1541013700\n 0%| | 0/28 [00:00<?, ?it/s]\n 7%|▋ | 2/28 [00:00<00:01, 18.02it/s]\n 14%|█▍ | 4/28 [00:00<00:01, 12.97it/s]\n 21%|██▏ | 6/28 [00:00<00:01, 11.90it/s]\n 29%|██▊ | 8/28 [00:00<00:01, 11.47it/s]\n 36%|███▌ | 10/28 [00:00<00:01, 11.09it/s]\n 43%|████▎ | 12/28 [00:01<00:01, 10.83it/s]\n 50%|█████ | 14/28 [00:01<00:01, 10.83it/s]\n 57%|█████▋ | 16/28 [00:01<00:01, 10.82it/s]\n 64%|██████▍ | 18/28 [00:01<00:00, 10.82it/s]\n 71%|███████▏ | 20/28 [00:01<00:00, 10.78it/s]\n 79%|███████▊ | 22/28 [00:01<00:00, 10.67it/s]\n 86%|████████▌ | 24/28 [00:02<00:00, 10.69it/s]\n 93%|█████████▎| 26/28 [00:02<00:00, 10.73it/s]\n100%|██████████| 28/28 [00:02<00:00, 10.73it/s]\n100%|██████████| 28/28 [00:02<00:00, 11.03it/s]\nTotal safe images: 1 out of 1",
"output": [
"https://replicate.delivery/xezq/YumehO0CBftCZUz9ubFKRXBGU3ZOePKrD7TivvfeUOW1F7FeE/out-0.webp"
],
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2024-11-14T00:28:27.199Z",
"started_at": "2024-11-14T00:28:27.204799Z",
"completed_at": "2024-11-14T00:28:30.579241Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/55tgxa28qxrm80ck50996j6yzg/cancel",
"get": "https://api.replicate.com/v1/predictions/55tgxa28qxrm80ck50996j6yzg",
"stream": "https://stream.replicate.com/v1/files/bcwr-4p76hgchoqzr65twu5srquso5xyww7i2veovf3hngdxdlp6nwkja",
"web": "https://replicate.com/p/55tgxa28qxrm80ck50996j6yzg"
},
"metrics": {
"image_count": 1,
"predict_time": 3.374442034,
"total_time": 3.380241
}
}