typetext
{
"aspect_ratio": "1:1",
"guidance_scale": 3.5,
"hf_lora": "https://replicate.delivery/yhqm/9vSmRCa8Vv7bFtKfCfXTRzTq4X71tZW0LtLCb1l49bTSo8TTA/trained_model.tar",
"image": "https://replicate.delivery/pbxt/LZvsjQcYuNfdmYuXETyePkaXNPCydRs4NJd9Nj4uSTVVQ0SO/image.png",
"lora_scale": 0.8,
"num_inference_steps": 28,
"num_outputs": 1,
"output_format": "webp",
"output_quality": 80,
"prompt": "portrait photo of TOK with purple hair",
"prompt_strength": 0.8
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_daV**********************************
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-lora 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-lora:c0702494406cf8cc4d69490f2b464a993e9c9e99731640ebfc22ec09eb94276a",
{
input: {
aspect_ratio: "1:1",
guidance_scale: 3.5,
hf_lora: "https://replicate.delivery/yhqm/9vSmRCa8Vv7bFtKfCfXTRzTq4X71tZW0LtLCb1l49bTSo8TTA/trained_model.tar",
image: "https://replicate.delivery/pbxt/LZvsjQcYuNfdmYuXETyePkaXNPCydRs4NJd9Nj4uSTVVQ0SO/image.png",
lora_scale: 0.8,
num_inference_steps: 28,
num_outputs: 1,
output_format: "webp",
output_quality: 80,
prompt: "portrait photo of TOK with purple hair",
prompt_strength: 0.8
}
}
);
// 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_daV**********************************
This is your API token. Keep it to yourself.
import replicate
Run lucataco/flux-dev-lora using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"lucataco/flux-dev-lora:c0702494406cf8cc4d69490f2b464a993e9c9e99731640ebfc22ec09eb94276a",
input={
"aspect_ratio": "1:1",
"guidance_scale": 3.5,
"hf_lora": "https://replicate.delivery/yhqm/9vSmRCa8Vv7bFtKfCfXTRzTq4X71tZW0LtLCb1l49bTSo8TTA/trained_model.tar",
"image": "https://replicate.delivery/pbxt/LZvsjQcYuNfdmYuXETyePkaXNPCydRs4NJd9Nj4uSTVVQ0SO/image.png",
"lora_scale": 0.8,
"num_inference_steps": 28,
"num_outputs": 1,
"output_format": "webp",
"output_quality": 80,
"prompt": "portrait photo of TOK with purple hair",
"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_daV**********************************
This is your API token. Keep it to yourself.
Run lucataco/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 $'{
"version": "lucataco/flux-dev-lora:c0702494406cf8cc4d69490f2b464a993e9c9e99731640ebfc22ec09eb94276a",
"input": {
"aspect_ratio": "1:1",
"guidance_scale": 3.5,
"hf_lora": "https://replicate.delivery/yhqm/9vSmRCa8Vv7bFtKfCfXTRzTq4X71tZW0LtLCb1l49bTSo8TTA/trained_model.tar",
"image": "https://replicate.delivery/pbxt/LZvsjQcYuNfdmYuXETyePkaXNPCydRs4NJd9Nj4uSTVVQ0SO/image.png",
"lora_scale": 0.8,
"num_inference_steps": 28,
"num_outputs": 1,
"output_format": "webp",
"output_quality": 80,
"prompt": "portrait photo of TOK with purple hair",
"prompt_strength": 0.8
}
}' \
https://api.replicate.com/v1/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
{
"id": "mwp3k848ksrj60chs708m97jxm",
"model": "lucataco/flux-dev-lora",
"version": "c0702494406cf8cc4d69490f2b464a993e9c9e99731640ebfc22ec09eb94276a",
"input": {
"aspect_ratio": "1:1",
"guidance_scale": 3.5,
"hf_lora": "https://replicate.delivery/yhqm/9vSmRCa8Vv7bFtKfCfXTRzTq4X71tZW0LtLCb1l49bTSo8TTA/trained_model.tar",
"image": "https://replicate.delivery/pbxt/LZvsjQcYuNfdmYuXETyePkaXNPCydRs4NJd9Nj4uSTVVQ0SO/image.png",
"lora_scale": 0.8,
"num_inference_steps": 28,
"num_outputs": 1,
"output_format": "webp",
"output_quality": 80,
"prompt": "portrait photo of TOK with purple hair",
"prompt_strength": 0.8
},
"logs": "Using seed: 44517\nPrompt: portrait photo of TOK with purple hair\nimg2img mode\nInput image size: 680x680\nInput image size set to: 688x688\nDownloading LoRA weights from - Replicate URL: https://replicate.delivery/yhqm/9vSmRCa8Vv7bFtKfCfXTRzTq4X71tZW0LtLCb1l49bTSo8TTA/trained_model.tar\nEnsuring enough disk space...\nDownloading weights: https://replicate.delivery/yhqm/9vSmRCa8Vv7bFtKfCfXTRzTq4X71tZW0LtLCb1l49bTSo8TTA/trained_model.tar\n2024-09-06T23:52:04Z | INFO | [ Initiating ] chunk_size=150M dest=/src/weights-cache/3183c8e9c43647c8 url=https://replicate.delivery/yhqm/9vSmRCa8Vv7bFtKfCfXTRzTq4X71tZW0LtLCb1l49bTSo8TTA/trained_model.tar\n2024-09-06T23:52:05Z | INFO | [ Complete ] dest=/src/weights-cache/3183c8e9c43647c8 size=\"172 MB\" total_elapsed=1.462s url=https://replicate.delivery/yhqm/9vSmRCa8Vv7bFtKfCfXTRzTq4X71tZW0LtLCb1l49bTSo8TTA/trained_model.tar\nb''\nDownloaded weights in 1.4893417358398438 seconds\nLoading LoRA took: 3.22 seconds\n/root/.pyenv/versions/3.11.9/lib/python3.11/site-packages/diffusers/configuration_utils.py:140: FutureWarning: Accessing config attribute `vae_latent_channels` directly via 'VaeImageProcessor' object attribute is deprecated. Please access 'vae_latent_channels' over 'VaeImageProcessor's config object instead, e.g. 'scheduler.config.vae_latent_channels'.\ndeprecate(\"direct config name access\", \"1.0.0\", deprecation_message, standard_warn=False)\n/root/.pyenv/versions/3.11.9/lib/python3.11/site-packages/diffusers/image_processor.py:582: FutureWarning: Passing `image` as torch tensor with value range in [-1,1] is deprecated. The expected value range for image tensor is [0,1] when passing as pytorch tensor or numpy Array. You passed `image` with value range [-1.0,1.0]\nwarnings.warn(\n 0%| | 0/23 [00:00<?, ?it/s]\n 4%|▍ | 1/23 [00:00<00:09, 2.29it/s]\n 9%|▊ | 2/23 [00:00<00:10, 2.01it/s]\n 13%|█▎ | 3/23 [00:01<00:10, 1.93it/s]\n 17%|█▋ | 4/23 [00:02<00:10, 1.89it/s]\n 22%|██▏ | 5/23 [00:02<00:09, 1.87it/s]\n 26%|██▌ | 6/23 [00:03<00:09, 1.86it/s]\n 30%|███ | 7/23 [00:03<00:08, 1.85it/s]\n 35%|███▍ | 8/23 [00:04<00:08, 1.85it/s]\n 39%|███▉ | 9/23 [00:04<00:07, 1.85it/s]\n 43%|████▎ | 10/23 [00:05<00:07, 1.84it/s]\n 48%|████▊ | 11/23 [00:05<00:06, 1.84it/s]\n 52%|█████▏ | 12/23 [00:06<00:05, 1.84it/s]\n 57%|█████▋ | 13/23 [00:06<00:05, 1.84it/s]\n 61%|██████ | 14/23 [00:07<00:04, 1.84it/s]\n 65%|██████▌ | 15/23 [00:08<00:04, 1.84it/s]\n 70%|██████▉ | 16/23 [00:08<00:03, 1.84it/s]\n 74%|███████▍ | 17/23 [00:09<00:03, 1.84it/s]\n 78%|███████▊ | 18/23 [00:09<00:02, 1.84it/s]\n 83%|████████▎ | 19/23 [00:10<00:02, 1.84it/s]\n 87%|████████▋ | 20/23 [00:10<00:01, 1.84it/s]\n 91%|█████████▏| 21/23 [00:11<00:01, 1.84it/s]\n 96%|█████████▌| 22/23 [00:11<00:00, 1.84it/s]\n100%|██████████| 23/23 [00:12<00:00, 1.84it/s]\n100%|██████████| 23/23 [00:12<00:00, 1.85it/s]",
"output": [
"https://replicate.delivery/yhqm/aWg8rzL8K5J6AZL1ZIPv9fpODQttgYdenTPx5syASmi0eo0mA/out-0.webp"
],
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2024-09-06T23:52:03.998Z",
"started_at": "2024-09-06T23:52:04.007838Z",
"completed_at": "2024-09-06T23:52:20.776381Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/mwp3k848ksrj60chs708m97jxm/cancel",
"get": "https://api.replicate.com/v1/predictions/mwp3k848ksrj60chs708m97jxm",
"web": "https://replicate.com/p/mwp3k848ksrj60chs708m97jxm"
},
"metrics": {
"predict_time": 16.768542524,
"total_time": 16.778381
}
}
