Compare commits

...
538 changed files with 109498 additions and 11 deletions
Generated
+101 -10
View File
@@ -1666,6 +1666,17 @@ dependencies = [
"serde",
]
[[package]]
name = "cargo-manifest"
version = "0.19.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1d8af896b707212cd0e99c112a78c9497dd32994192a463ed2f7419d29bd8c6"
dependencies = [
"serde",
"thiserror 2.0.12",
"toml 0.8.22",
]
[[package]]
name = "cargo-platform"
version = "0.1.9"
@@ -3537,8 +3548,6 @@ dependencies = [
[[package]]
name = "fal"
version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8fd7dd8565317310f05569296166e2cbdd2bc870173b2b24b77ed681166268d0"
dependencies = [
"base64 0.22.1",
"eventsource-stream",
@@ -3550,13 +3559,12 @@ dependencies = [
"serde_json",
"smart-default 0.7.1",
"thiserror 1.0.63",
"tokio",
]
[[package]]
name = "fal-derive"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87f377f2f18a6bf107f907aa687df6bda2874bd38b25b1531f2a6fb38a9ca643"
dependencies = [
"proc-macro2",
"quote",
@@ -4037,6 +4045,21 @@ dependencies = [
"x11",
]
[[package]]
name = "generate-endpoints"
version = "0.1.0"
dependencies = [
"cargo-manifest",
"percent-encoding",
"reqwest 0.12.15",
"serde",
"serde_json",
"tokio",
"toml 0.8.22",
"tracing",
"tracing-subscriber",
]
[[package]]
name = "generic-array"
version = "0.14.7"
@@ -6384,6 +6407,16 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0676bb32a98c1a483ce53e500a81ad9c3d5b3f7c920c28c24e9cb0980d0b5bc8"
[[package]]
name = "nu-ansi-term"
version = "0.46.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84"
dependencies = [
"overload",
"winapi 0.3.9",
]
[[package]]
name = "num"
version = "0.4.3"
@@ -7018,6 +7051,12 @@ dependencies = [
"pin-project-lite",
]
[[package]]
name = "overload"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39"
[[package]]
name = "p256"
version = "0.13.2"
@@ -9342,6 +9381,15 @@ dependencies = [
"keccak",
]
[[package]]
name = "sharded-slab"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6"
dependencies = [
"lazy_static",
]
[[package]]
name = "shared_service_components"
version = "0.0.1"
@@ -10831,6 +10879,16 @@ dependencies = [
"syn 2.0.87",
]
[[package]]
name = "thread_local"
version = "1.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c"
dependencies = [
"cfg-if 1.0.0",
"once_cell",
]
[[package]]
name = "thumbnail_generator"
version = "0.1.0"
@@ -11156,6 +11214,7 @@ version = "0.8.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "05ae329d1f08c4d17a59bed7ff5b5a769d062e64a62d34a3261b219e62cd5aae"
dependencies = [
"indexmap 2.9.0",
"serde",
"serde_spanned",
"toml_datetime",
@@ -11302,9 +11361,9 @@ checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3"
[[package]]
name = "tracing"
version = "0.1.40"
version = "0.1.41"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef"
checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0"
dependencies = [
"log",
"pin-project-lite",
@@ -11314,9 +11373,9 @@ dependencies = [
[[package]]
name = "tracing-attributes"
version = "0.1.27"
version = "0.1.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7"
checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d"
dependencies = [
"proc-macro2",
"quote",
@@ -11325,11 +11384,37 @@ dependencies = [
[[package]]
name = "tracing-core"
version = "0.1.32"
version = "0.1.33"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54"
checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c"
dependencies = [
"once_cell",
"valuable",
]
[[package]]
name = "tracing-log"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3"
dependencies = [
"log",
"once_cell",
"tracing-core",
]
[[package]]
name = "tracing-subscriber"
version = "0.3.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8189decb5ac0fa7bc8b96b7cb9b2701d60d48805aca84a238004d665fcc4008"
dependencies = [
"nu-ansi-term",
"sharded-slab",
"smallvec 1.13.2",
"thread_local",
"tracing-core",
"tracing-log",
]
[[package]]
@@ -11741,6 +11826,12 @@ dependencies = [
"wasm-bindgen",
]
[[package]]
name = "valuable"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65"
[[package]]
name = "value-bag"
version = "1.10.0"
+3
View File
@@ -113,6 +113,9 @@ members = [
"crates/service/plugins/user_traits_component",
# Vendored code
"crates/vendor/fal-rs",
"crates/vendor/fal-rs/fal-derive",
"crates/vendor/fal-rs/generate",
"crates/vendor/limitation",
"crates/vendor/tauri-plugin-http",
# NB(bt,2025-05-25): Too many failures on Mac. Disable for now.
+5 -1
View File
@@ -22,12 +22,16 @@ errors = { workspace = true }
# External
anyhow = { workspace = true }
fal = { version = "0.3.6", features = ["endpoints"] }
futures = { workspace = true }
reqwest = { workspace = true }
serde = { workspace = true }
tokio = { workspace = true }
url = { workspace = true }
# For now, we'll vendor in fal.
# We need to implement webhooks and the upstream doesn't support them yet.
#fal = { version = "0.3.6", features = ["endpoints"] }
fal = { path = "../../../vendor/fal-rs", features = ["endpoints"] }
[dev-dependencies]
testing = { path = "../../testing" }
+1
View File
@@ -0,0 +1 @@
src/endpoints
+68
View File
@@ -0,0 +1,68 @@
name: Bump Version
on:
workflow_dispatch:
inputs:
version_type:
description: "Version bump type (major, minor, patch)"
required: true
default: "patch"
type: choice
options:
- major
- minor
- patch
env:
CARGO_TERM_COLOR: always
jobs:
bump-version:
name: Bump Version
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
ref: main
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Rust Cache
uses: Swatinem/rust-cache@v2
- name: Configure Git
run: |
git config user.name "GitHub Actions"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Create branch
run: |
branch_name="bump/version-$(date +%Y%m%d-%H%M%S)"
git checkout -b $branch_name
echo "BRANCH_NAME=$branch_name" >> $GITHUB_ENV
- name: Bump version
run: |
cargo install cargo-bump
cargo bump ${{ inputs.version_type }}
- name: Commit changes
run: |
git add .
git commit -m "chore: bump version (${{ inputs.version_type }})"
git push origin ${{ env.BRANCH_NAME }}
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
title: "chore: bump version (${{ inputs.version_type }})"
body: |
This PR was automatically created by the Bump Version workflow.
- Bumps version (${{ inputs.version_type }})
branch: ${{ env.BRANCH_NAME }}
base: main
+28
View File
@@ -0,0 +1,28 @@
name: cargo fmt
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
env:
CARGO_TERM_COLOR: always
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Rust Cache
uses: Swatinem/rust-cache@v2
- name: Run cargo test
env:
FAL_API_KEY: ${{ secrets.FAL_API_KEY }}
run: cargo fmt --all --check
+26
View File
@@ -0,0 +1,26 @@
name: cargo check
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
env:
CARGO_TERM_COLOR: always
jobs:
check:
name: Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Rust Cache
uses: Swatinem/rust-cache@v2
- name: Run cargo check
run: cargo check --all-features --workspace
+49
View File
@@ -0,0 +1,49 @@
name: Generate Endpoints
on:
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
jobs:
generate:
name: Generate Endpoints
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Rust Cache
uses: Swatinem/rust-cache@v2
- name: Generate endpoints
run: cargo run -p generate-endpoints
- name: cargo fmt
run: cargo fmt
- name: Check for changes
id: git-check
run: |
if [[ -n "$(git status --porcelain)" ]]; then
echo "changes=true" >> $GITHUB_OUTPUT
else
echo "changes=false" >> $GITHUB_OUTPUT
fi
- name: Create Pull Request
if: steps.git-check.outputs.changes == 'true'
uses: peter-evans/create-pull-request@v7
with:
commit-message: "chore: update generated endpoints"
title: Update Endpoints
body: Automated update of generated endpoints
branch: update-endpoints
+70
View File
@@ -0,0 +1,70 @@
name: Publish to crates.io
on:
workflow_dispatch:
inputs:
version_bump:
description: "Version bump type (major, minor, patch)"
required: false
default: "patch"
type: choice
options:
- major
- minor
- patch
env:
CARGO_TERM_COLOR: always
jobs:
publish:
name: Publish to crates.io
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Rust Cache
uses: Swatinem/rust-cache@v2
- name: Install cargo-bump
run: cargo install cargo-bump
- name: Bump version
run: |
cargo bump ${{ github.event.inputs.version_bump }}
version=$(cargo pkgid | cut -d# -f2 | cut -d: -f2)
echo "NEW_VERSION=$version" >> $GITHUB_ENV
# Extract major.minor version for README updates
major_minor=$(echo $version | cut -d. -f1,2)
echo "MAJOR_MINOR=$major_minor" >> $GITHUB_ENV
- name: Update README versions
run: |
# Use perl for in-place replacement of version strings in README
perl -i -pe 's/fal = "[\d\.]+"/fal = "${{ env.MAJOR_MINOR }}"/' README.md
perl -i -pe 's/fal = \{ version = "[\d\.]+"/fal = { version = "${{ env.MAJOR_MINOR }}"/' README.md
- name: Publish to crates.io
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: |
cargo publish -p fal
- name: Configure Git
run: |
git config user.name "GitHub Actions"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Commit and push changes
run: |
git add .
git commit -m "chore: bump version to ${{ env.NEW_VERSION }}"
git tag "v${{ env.NEW_VERSION }}"
git push origin main
git push origin "v${{ env.NEW_VERSION }}"
- name: Create Github Release
uses: softprops/action-gh-release@v2
+28
View File
@@ -0,0 +1,28 @@
name: cargo test
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
env:
CARGO_TERM_COLOR: always
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Rust Cache
uses: Swatinem/rust-cache@v2
- name: Run cargo test
env:
FAL_API_KEY: ${{ secrets.FAL_API_KEY }}
run: cargo test --all-features --workspace
+10
View File
@@ -0,0 +1,10 @@
/target
examples/*/target
examples/*/Cargo.lock
.fastembed_cache
/backup.sql
.env*
.DS_Store
Cargo.lock
+3
View File
@@ -0,0 +1,3 @@
{
"rust-analyzer.cargo.features": []
}
+280
View File
@@ -0,0 +1,280 @@
[package]
name = "fal"
edition = "2021"
version = "0.3.6"
authors = ["Carlos Diaz-Padron"]
description = "A Rust crate for the fal.ai API, including generated, typed functions for all public models"
keywords = [
"fal",
"ai",
"generative-ai",
]
categories = ["api-bindings"]
license = "MIT OR Apache-2.0"
repository = "https://github.com/carlosdp/fal-rs"
[package.metadata.docs.rs]
all-features = true
#[workspace]
#members = [
# "fal-derive",
# "generate",
#]
#resolver = "2"
#[workspace.dependencies]
#reqwest = "0.12"
#serde = "1"
#serde_json = "1"
#tokio = "1"
[dependencies]
eventsource-stream = "0.2"
smart-default = "0.7"
thiserror = "1"
[dependencies.base64]
version = "0.22"
optional = true
[dependencies.fal-derive]
version = "0.1"
path = "./fal-derive"
[dependencies.futures]
version = "0.3"
optional = true
[dependencies.image]
version = "0.25"
optional = true
[dependencies.reqwest]
workspace = true
features = [
"json",
"stream",
]
[dependencies.serde]
workspace = true
features = ["derive"]
[dependencies.serde_json]
workspace = true
[dev-dependencies.tokio]
workspace = true
features = ["full"]
[features]
default = ["image"]
endpoints = []
endpoints_easel-ai = []
endpoints_easel-ai_advanced-face-swap = []
endpoints_fal-ai = []
endpoints_fal-ai_amt-interpolation = []
endpoints_fal-ai_animatediff-sparsectrl-lcm = []
endpoints_fal-ai_animatediff-v2v = []
endpoints_fal-ai_any-llm = []
endpoints_fal-ai_aura-flow = []
endpoints_fal-ai_aura-sr = []
endpoints_fal-ai_auto-caption = []
endpoints_fal-ai_ben = []
endpoints_fal-ai_birefnet = []
endpoints_fal-ai_bria = []
endpoints_fal-ai_cat-vton = []
endpoints_fal-ai_ccsr = []
endpoints_fal-ai_clarity-upscaler = []
endpoints_fal-ai_codeformer = []
endpoints_fal-ai_cogvideox-5b = []
endpoints_fal-ai_cogview4 = []
endpoints_fal-ai_controlnext = []
endpoints_fal-ai_creative-upscaler = []
endpoints_fal-ai_csm-1b = []
endpoints_fal-ai_ddcolor = []
endpoints_fal-ai_diffrhythm = []
endpoints_fal-ai_diffusion-edge = []
endpoints_fal-ai_docres = []
endpoints_fal-ai_drct-super-resolution = []
endpoints_fal-ai_dreamshaper = []
endpoints_fal-ai_dubbing = []
endpoints_fal-ai_dwpose = []
endpoints_fal-ai_elevenlabs = []
endpoints_fal-ai_era-3d = []
endpoints_fal-ai_esrgan = []
endpoints_fal-ai_evf-sam = []
endpoints_fal-ai_eye-correct = []
endpoints_fal-ai_f5-tts = []
endpoints_fal-ai_face-to-sticker = []
endpoints_fal-ai_fast-animatediff = []
endpoints_fal-ai_fast-fooocus-sdxl = []
endpoints_fal-ai_fast-lcm-diffusion = []
endpoints_fal-ai_fast-lightning-sdxl = []
endpoints_fal-ai_fast-sdxl = []
endpoints_fal-ai_fast-sdxl-controlnet-canny = []
endpoints_fal-ai_fast-svd = []
endpoints_fal-ai_fast-svd-lcm = []
endpoints_fal-ai_fast-turbo-diffusion = []
endpoints_fal-ai_ffmpeg-api = []
endpoints_fal-ai_florence-2-large = []
endpoints_fal-ai_flowedit = []
endpoints_fal-ai_flux = []
endpoints_fal-ai_flux-control-lora-canny = []
endpoints_fal-ai_flux-control-lora-depth = []
endpoints_fal-ai_flux-differential-diffusion = []
endpoints_fal-ai_flux-general = []
endpoints_fal-ai_flux-lora = []
endpoints_fal-ai_flux-lora-canny = []
endpoints_fal-ai_flux-lora-depth = []
endpoints_fal-ai_flux-lora-fast-training = []
endpoints_fal-ai_flux-lora-fill = []
endpoints_fal-ai_flux-lora-portrait-trainer = []
endpoints_fal-ai_flux-pro = []
endpoints_fal-ai_flux-pro-trainer = []
endpoints_fal-ai_flux-pulid = []
endpoints_fal-ai_flux-subject = []
endpoints_fal-ai_fooocus = []
endpoints_fal-ai_gemini-flash-edit = []
endpoints_fal-ai_got-ocr = []
endpoints_fal-ai_hunyuan-video = []
endpoints_fal-ai_hunyuan-video-image-to-video = []
endpoints_fal-ai_hunyuan-video-img2vid-lora = []
endpoints_fal-ai_hunyuan-video-lora = []
endpoints_fal-ai_hunyuan-video-lora-training = []
endpoints_fal-ai_hunyuan3d = []
endpoints_fal-ai_hyper-sdxl = []
endpoints_fal-ai_hyper3d = []
endpoints_fal-ai_iclight-v2 = []
endpoints_fal-ai_ideogram = []
endpoints_fal-ai_illusion-diffusion = []
endpoints_fal-ai_image-preprocessors = []
endpoints_fal-ai_imagen3 = []
endpoints_fal-ai_imageutils = []
endpoints_fal-ai_inpaint = []
endpoints_fal-ai_invisible-watermark = []
endpoints_fal-ai_ip-adapter-face-id = []
endpoints_fal-ai_janus = []
endpoints_fal-ai_kling = []
endpoints_fal-ai_kling-video = []
endpoints_fal-ai_kokoro = []
endpoints_fal-ai_kolors = []
endpoints_fal-ai_latentsync = []
endpoints_fal-ai_layer-diffusion = []
endpoints_fal-ai_lcm = []
endpoints_fal-ai_lcm-sd15-i2i = []
endpoints_fal-ai_leffa = []
endpoints_fal-ai_lightning-models = []
endpoints_fal-ai_live-portrait = []
endpoints_fal-ai_llava-next = []
endpoints_fal-ai_llavav15-13b = []
endpoints_fal-ai_lora = []
endpoints_fal-ai_ltx-video = []
endpoints_fal-ai_ltx-video-v095 = []
endpoints_fal-ai_luma-dream-machine = []
endpoints_fal-ai_luma-photon = []
endpoints_fal-ai_lumina-image = []
endpoints_fal-ai_mini-cpm = []
endpoints_fal-ai_minimax = []
endpoints_fal-ai_minimax-image = []
endpoints_fal-ai_minimax-music = []
endpoints_fal-ai_mix-dehaze-net = []
endpoints_fal-ai_mmaudio-v2 = []
endpoints_fal-ai_mochi-v1 = []
endpoints_fal-ai_moondream = []
endpoints_fal-ai_moondream-next = []
endpoints_fal-ai_musetalk = []
endpoints_fal-ai_nafnet = []
endpoints_fal-ai_omni-zero = []
endpoints_fal-ai_omnigen-v1 = []
endpoints_fal-ai_photomaker = []
endpoints_fal-ai_pika = []
endpoints_fal-ai_pixart-sigma = []
endpoints_fal-ai_pixverse = []
endpoints_fal-ai_playai = []
endpoints_fal-ai_playground-v25 = []
endpoints_fal-ai_post-processing = []
endpoints_fal-ai_pulid = []
endpoints_fal-ai_realistic-vision = []
endpoints_fal-ai_recraft-20b = []
endpoints_fal-ai_recraft-clarity-upscale = []
endpoints_fal-ai_recraft-creative-upscale = []
endpoints_fal-ai_recraft-v3 = []
endpoints_fal-ai_retoucher = []
endpoints_fal-ai_sa2va = []
endpoints_fal-ai_sadtalker = []
endpoints_fal-ai_sam2 = []
endpoints_fal-ai_sana = []
endpoints_fal-ai_sd15-depth-controlnet = []
endpoints_fal-ai_sdxl-controlnet-union = []
endpoints_fal-ai_skyreels-i2v = []
endpoints_fal-ai_stable-audio = []
endpoints_fal-ai_stable-cascade = []
endpoints_fal-ai_stable-diffusion-v15 = []
endpoints_fal-ai_stable-diffusion-v3-medium = []
endpoints_fal-ai_stable-diffusion-v35-large = []
endpoints_fal-ai_stable-diffusion-v35-medium = []
endpoints_fal-ai_stable-video = []
endpoints_fal-ai_stepfun-video = []
endpoints_fal-ai_swin2sr = []
endpoints_fal-ai_switti = []
endpoints_fal-ai_sync-lipsync = []
endpoints_fal-ai_t2v-turbo = []
endpoints_fal-ai_thera = []
endpoints_fal-ai_topaz = []
endpoints_fal-ai_transpixar = []
endpoints_fal-ai_trellis = []
endpoints_fal-ai_triposr = []
endpoints_fal-ai_veo2 = []
endpoints_fal-ai_video-prompt-generator = []
endpoints_fal-ai_video-upscaler = []
endpoints_fal-ai_vidu = []
endpoints_fal-ai_wan = []
endpoints_fal-ai_wan-effects = []
endpoints_fal-ai_wan-i2v = []
endpoints_fal-ai_wan-i2v-lora = []
endpoints_fal-ai_wan-pro = []
endpoints_fal-ai_wan-t2v = []
endpoints_fal-ai_wan-trainer = []
endpoints_fal-ai_whisper = []
endpoints_fal-ai_wizper = []
endpoints_fal-ai_workflowutils = []
endpoints_fal-ai_yue = []
endpoints_fal-ai_zonos = []
endpoints_fashn = []
endpoints_fashn_tryon = []
endpoints_rundiffusion-fal = []
endpoints_rundiffusion-fal_juggernaut-flux = []
endpoints_rundiffusion-fal_juggernaut-flux-lora = []
endpoints_rundiffusion-fal_rundiffusion-photo-flux = []
image = [
"dep:image",
"futures",
"base64",
]
[[test]]
path = "tests/endpoints.rs"
name = "endpoints"
edition = "2021"
required-features = ["endpoints_fal-ai_flux"]
[[test]]
path = "tests/queue.rs"
name = "queue"
edition = "2021"
required-features = []
[[test]]
path = "tests/send.rs"
name = "send"
edition = "2021"
required-features = []
[lib]
path = "src/lib.rs"
name = "fal"
edition = "2021"
required-features = []
crate-type = ["lib"]
+201
View File
@@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) [year] [fullname]
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+178
View File
@@ -0,0 +1,178 @@
# fal-rs
[![Crates.io](https://img.shields.io/crates/v/fal.svg)](https://crates.io/crates/fal)
[![Documentation](https://docs.rs/fal/badge.svg)](https://docs.rs/fal)
[![License](https://img.shields.io/badge/license-MIT%2FApache--2.0-blue.svg)](LICENSE-MIT)
A Rust client for the [fal.ai](https://fal.ai) API, providing easy access to state-of-the-art AI models for image generation, audio processing, and more.
## Features
- **Type-safe API**: Strongly typed interfaces for all fal.ai endpoints, generated and kept up-to-date straight from the API itself
- **Compile Time Efficient**: FAL API Endpoint modules are code generated from the API with granular features, so you only build the set of endpoints you actually use!
- **Async/Await Support**: Built on top of `reqwest` for efficient async operations
- **Queue System**: Built-in support for fal.ai's queue system for long-running operations
## Installation
Add this to your `Cargo.toml`:
```toml
[dependencies]
fal = "0.3"
```
## Usage
### Using public model endpoints
By default, endpoints are disabled. The FAL API has hundreds of endpoints, and are growing in number by the day. In order to prevent compile time and binary size bloat, this crate supports somewhat fine-grained crate features for enabling endpoints, as you need them. To use pre-built, fully-typed endpoint functions to call the API, you can enable them by enabling the corresponding feature for that group of endpoints. For example, for the `fal-ai/flux/dev` endpoint, I can enable it like this:
```toml
# In Cargo.toml
fal = { version = "0.3", features = ["endpoints_fal-ai_flux"] }
```
**Note**: The features go a maximum of two "levels", so you can enable `fal-ai/flux`, which enables all endpoints under `fal-ai/flux`, or `fal-ai`, or all endpoints in the API.
or, I can enable *all* endpoints under the `fal-ai` owner:
```toml
# In Cargo.toml
fal = { version = "0.3", features = ["endpoints_fal-ai"] }
```
or if I'm really crazy, I can just enable all endpoints in the API:
```toml
# In Cargo.toml
fal = { version = "0.3", features = ["endpoints"] }
```
Once enabled, the endpoint can be called like this:
```rust,no_run
use fal::prelude::*;
use fal::endpoints::fal_ai::flux;
#[tokio::main]
async fn main() {
let api_key = std::env::var("FAL_API_KEY").unwrap();
// Use the Flux Dev endpoint to generate an image
let response = flux::dev::dev(flux::dev::DevTextToImageInput {
prompt: "a majestic horse in a field".to_string(),
..Default::default()
})
.with_api_key(api_key) // If not provided, the FAL_API_KEY environment variable is used
.send()
.await
.unwrap();
println!("Generated image URL: {}", response.images[0].url);
}
```
### Using the Queue System
For long-running operations, you can use the [FAL Queue API](https://docs.fal.ai/model-endpoints/queue):
```rust,no_run
use fal::prelude::*;
use fal::endpoints::fal_ai::flux;
use futures::StreamExt;
#[tokio::main]
async fn main() {
let queue = flux::dev::dev(flux::dev::DevTextToImageInput {
prompt: "a majestic horse in a field".to_string(),
..Default::default()
})
.queue()
.await
.unwrap();
// Stream status updates
while let Some(status) = queue.stream(true).await.unwrap().next().await {
let status = status.unwrap();
println!("Status: {:?}", status.status);
if status.status == Status::Completed {
break;
}
}
let response = queue.response().await.unwrap();
println!("Generated image URL: {}", response.images[0].url);
}
```
### The `#[endpoint]` macro
You can easily create a custom endpoint function using the provided [endpoint](crate::endpoint) proc macro. This should only be necessary if you are using a private model endpoint, or you really just want control over your types. Otherwise, you should be able to find the endpoint you want to use in the pre-built endpoints module!
```rust,no_run
use fal::prelude::*;
use serde::Deserialize;
#[derive(Debug, Deserialize)]
pub struct File {
pub url: String,
pub content_type: String,
pub file_name: Option<String>,
pub file_size: Option<i64>,
pub width: Option<i64>,
pub height: Option<i64>,
}
#[derive(Deserialize)]
pub struct FalResponse {
pub images: Vec<File>,
}
#[endpoint(endpoint="fal-ai/flux/dev")]
pub fn flux_dev(prompt: String) -> FalResponse {}
// This endpoint function can now be used to call the fal endpoint:
#[tokio::main]
async fn main() {
let response = flux_dev("an horse riding an astronaut".to_owned())
.send()
.await
.unwrap();
println!("Generated image URL: {}", response.images[0].url);
}
```
## Features
The crate comes with several optional features:
- `endpoints_*`: Include pre-generated endpoint modules for fal.ai services. See "Using public model endpoints" above for details.
## Generating Endpoint Modules
The `generate` package in this repository is used to automatically generate endpoint modules based on the fal.ai API specification. This ensures that the client always has up-to-date type definitions and endpoint implementations.
To generate endpoint modules:
1. Clone the repository
2. Run the generate package:
```bash
cargo run -p generate-endpoints
```
This will update the endpoint modules in the `fal/src/endpoints` directory with the latest API definitions, using the model registry from the FAL API.
## License
Licensed under either of:
* Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
* MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
at your option.
## Contributing
We welcome contributions! Please feel free to submit a Pull Request.
+17
View File
@@ -0,0 +1,17 @@
[package]
name = "fal-derive"
description = "Macros for creating fal API endpoint functions"
version = "0.1.0"
edition = "2021"
repository = "https://github.com/carlosdp/fal-rs"
license = "MIT OR Apache-2.0"
keywords = ["fal", "ai", "generative-ai"]
authors = ["Carlos Diaz-Padron"]
[lib]
proc-macro = true
[dependencies]
syn = { version = "2.0", features = ["full"] }
quote = "1.0"
proc-macro2 = "1.0"
+25
View File
@@ -0,0 +1,25 @@
Creates a custom endpoint function, compatible with the fal API.
```rust,ignore
use fal::prelude::*;
use serde::Deserialize;
#[derive(Deserialize)]
pub struct FalResponse {
pub images: Vec<File>,
}
#[endpoint(endpoint="fal-ai/flux/dev")]
pub fn flux_dev(prompt: String) -> FalResponse {}
// This endpoint function can now be used to call the fal endpoint:
#[tokio::main]
async fn main() {
let response = flux_dev("an horse riding an astronaut".to_owned())
.send()
.await
.unwrap();
println!("Generated image URL: {}", response.images[0].url);
}
```
+133
View File
@@ -0,0 +1,133 @@
use proc_macro::TokenStream;
use quote::quote;
use syn::{
parse::Parse, parse::ParseStream, parse_macro_input, punctuated::Punctuated, FnArg, ItemFn,
Meta, PatType, ReturnType, Token,
};
enum EndpointAttr {
Path(String),
InFalCrate,
}
impl Parse for EndpointAttr {
fn parse(input: ParseStream) -> syn::Result<Self> {
let meta: Meta = input.parse()?;
match meta {
Meta::Path(path) if path.is_ident("in_fal_crate") => Ok(EndpointAttr::InFalCrate),
Meta::NameValue(nv) if nv.path.is_ident("endpoint") => match nv.value {
syn::Expr::Lit(lit) => {
if let syn::Lit::Str(s) = lit.lit {
return Ok(EndpointAttr::Path(s.value()));
}
Err(syn::Error::new_spanned(lit, "expected string literal"))
}
_ => Err(syn::Error::new_spanned(nv.value, "expected string literal")),
},
_ => Err(syn::Error::new_spanned(
meta,
"expected endpoint = \"...\" or in_fal_crate",
)),
}
}
}
#[doc = include_str!("../README.md")]
#[proc_macro_attribute]
pub fn endpoint(attr: TokenStream, item: TokenStream) -> TokenStream {
let attr =
parse_macro_input!(attr with Punctuated::<EndpointAttr, Token![,]>::parse_terminated);
let input_fn = parse_macro_input!(item as ItemFn);
// Extract the endpoint string and in_fal_crate flag from the attributes
let mut endpoint_str = None;
let mut in_fal_crate = false;
for attr in attr.iter() {
match attr {
EndpointAttr::Path(s) => endpoint_str = Some(s),
EndpointAttr::InFalCrate => in_fal_crate = true,
}
}
let endpoint_str = endpoint_str.expect("endpoint attribute must be provided");
let fn_name = &input_fn.sig.ident;
let fn_name_str = fn_name.to_string();
let camel_case_name = snake_to_upper_camel(&fn_name_str);
let struct_name = syn::Ident::new(&format!("{}Params", camel_case_name), fn_name.span());
let vis = &input_fn.vis;
// Extract function parameters
let mut param_fields = Vec::new();
let mut param_names = Vec::new();
for arg in input_fn.sig.inputs.iter() {
if let FnArg::Typed(PatType { pat, ty, .. }) = arg {
if let syn::Pat::Ident(pat_ident) = *pat.clone() {
let ident = pat_ident.ident.clone();
param_fields.push(quote! { pub #ident: #ty });
param_names.push(pat_ident.ident);
}
}
}
// Extract return type
let return_type = match &input_fn.sig.output {
ReturnType::Type(_, ty) => ty,
_ => panic!("Function must have a return type"),
};
// Choose the appropriate crate reference
let crate_ref = if in_fal_crate {
quote! { crate }
} else {
quote! { fal }
};
// Generate the expanded code
let struct_def = quote! {
#[derive(serde::Serialize)]
#vis struct #struct_name {
#(#param_fields),*
}
};
let inputs = input_fn.sig.inputs;
let fn_def = quote! {
#vis fn #fn_name(#inputs) -> #crate_ref::request::FalRequest<#struct_name, #return_type> {
#crate_ref::request::FalRequest::new(
#endpoint_str,
#struct_name {
#(#param_names: #param_names),*
}
)
}
};
let expanded = quote! {
#struct_def
#fn_def
};
TokenStream::from(expanded)
}
fn snake_to_upper_camel(input: &str) -> String {
let mut result = String::new();
let mut capitalize_next = true;
for c in input.chars() {
if c == '_' {
capitalize_next = true;
} else if capitalize_next {
result.push(c.to_ascii_uppercase());
capitalize_next = false;
} else {
result.push(c);
}
}
result
}
+16
View File
@@ -0,0 +1,16 @@
[package]
name = "generate-endpoints"
version = "0.1.0"
edition = "2021"
publish = false
[dependencies]
reqwest = { version = "0.12", features = ["json", "stream", "multipart"] }
tokio = { version = "1", features = ["full"] }
serde = { version = "1", features = ["derive"] }
serde_json = { version = "1" }
percent-encoding = "2.3"
tracing = "0.1.41"
tracing-subscriber = "0.3.19"
cargo-manifest = "0.19"
toml = "0.8"
+47
View File
@@ -0,0 +1,47 @@
use serde::Deserialize;
#[derive(Debug, Deserialize)]
#[allow(dead_code)]
pub struct ModelGroup {
pub key: String,
pub label: String,
}
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
#[allow(dead_code)]
pub struct Model {
pub id: String,
pub title: String,
pub category: String,
#[serde(default)]
pub tags: Vec<String>,
pub short_description: String,
pub thumbnail_url: String,
pub model_url: String,
pub stream_url: Option<String>,
pub date: String,
pub machine_type: Option<String>,
pub license_type: Option<String>,
pub group: Option<ModelGroup>,
#[serde(default)]
pub result_comparison: bool,
#[serde(default)]
pub highlighted: bool,
pub pricing_info_override: Option<String>,
pub credits_required: Option<i32>,
pub endpoint_id: String,
}
#[derive(Debug, Deserialize)]
#[allow(dead_code)]
pub struct AppDataMetadata {
pub openapi: serde_json::Value,
}
#[derive(Debug, Deserialize)]
#[allow(dead_code)]
pub struct AppData {
pub app_name: String,
pub metadata: AppDataMetadata,
}
+55
View File
@@ -0,0 +1,55 @@
pub fn snake_to_upper_camel(input: &str) -> String {
let mut result = String::new();
let mut capitalize_next = true;
for c in input.chars() {
if c == '_' {
capitalize_next = true;
} else if capitalize_next {
result.push(c.to_ascii_uppercase());
capitalize_next = false;
} else {
result.push(c);
}
}
result
}
pub fn to_snake_case(input: &str) -> String {
let mut result = String::new();
let mut prev_is_uppercase = false;
for (i, c) in input.chars().enumerate() {
if c.is_uppercase() {
if i > 0 && !prev_is_uppercase {
result.push('_');
}
result.push(c.to_lowercase().next().unwrap());
prev_is_uppercase = true;
} else {
result.push(if c.is_whitespace() || c == '-' {
'_'
} else {
c
});
prev_is_uppercase = false;
}
}
result
}
pub fn is_rust_keyword(word: &str) -> bool {
const KEYWORDS: &[&str] = &[
"as", "break", "const", "continue", "crate", "else", "enum", "extern", "false", "fn",
"for", "if", "impl", "in", "let", "loop", "match", "mod", "move", "mut", "pub", "ref",
"return", "self", "Self", "static", "struct", "super", "trait", "true", "type", "unsafe",
"use", "where", "while", // Reserved for future use
"abstract", "async", "await", "become", "box", "do", "final", "macro", "override", "priv",
"try", "typeof", "unsized", "virtual", "yield", // Strict mode keywords
"dyn",
];
KEYWORDS.contains(&word)
}
+292
View File
@@ -0,0 +1,292 @@
mod fal_data;
mod helpers;
mod module;
mod types;
use fal_data::*;
use module::*;
use types::*;
use std::collections::HashSet;
use cargo_manifest::Manifest;
use percent_encoding::{utf8_percent_encode, NON_ALPHANUMERIC};
#[tokio::main]
async fn main() {
tracing_subscriber::fmt::init();
let base_module_path = "src/endpoints";
let mut root = Node::Module {
name: "endpoints".to_string(),
children: Vec::new(),
};
let client = reqwest::Client::new();
let models: Vec<Model> = client
.get("https://fal.ai/api/models")
.send()
.await
.unwrap()
.error_for_status()
.unwrap()
.json()
.await
.unwrap();
// De-duplicate, because the /models endpoint returns multiple endpoints within an alias
let mut visited_aliases = HashSet::new();
for model in &models {
let (owner, endpoint) = model
.endpoint_id
.split_once("/")
.expect(&format!("could not split endpoint: {}", &model.endpoint_id));
// URL encode the alias to handle special characters in the endpoint
let parts = endpoint.split("/").collect::<Vec<&str>>();
let alias = parts[0];
if visited_aliases.contains(alias) {
continue;
}
visited_aliases.insert(alias);
let encoded_alias = utf8_percent_encode(alias, NON_ALPHANUMERIC).to_string();
let app_data: AppData = client
.get(format!(
"https://fal.ai/api/models/app-data?owner={owner}&alias={encoded_alias}"
))
.send()
.await
.unwrap()
.error_for_status()
.unwrap()
.json()
.await
.unwrap();
let paths = app_data.metadata.openapi["paths"].as_object().unwrap();
for (path, params) in paths {
if path == "/health" {
// skip healthcheck endpoint
continue;
}
let module_parts = if path == "/" {
vec![]
} else {
path.split("/")
.skip(1)
.map(|s| s.replace(".", "_").replace("-", "_"))
.map(|s| {
if s.chars().next().unwrap().is_digit(10) {
format!("v{s}")
} else {
s.to_string()
}
})
.collect::<Vec<String>>()
};
let parent_parts = vec![
owner.replace(".", "_").replace("-", "_"),
alias
.split("/")
.collect::<Vec<&str>>()
.join("::")
.replace(".", "_")
.replace("-", "_"),
]
.into_iter()
.map(|s| {
if s.chars().next().unwrap().is_digit(10) {
format!("v{s}")
} else {
s.to_string()
}
})
.collect::<Vec<_>>();
let fn_name = if module_parts.is_empty() {
parent_parts
.last()
.unwrap_or(&"default".to_string())
.to_string()
} else {
module_parts.last().unwrap().to_string()
};
// Combine parent and module parts for the full path
let mut full_path_parts = Vec::new();
// Don't include the root module name since it's just the container
full_path_parts.extend(parent_parts.iter().map(String::as_str));
full_path_parts.extend(module_parts.iter().map(String::as_str));
let Some(output_type_ref) = params["post"]["responses"]["200"]["content"]
["application/json"]["schema"]["$ref"]
.as_str()
else {
tracing::error!("no output type ref for {}", &model.endpoint_id);
tracing::error!("params: {:?}", params);
continue;
};
let output_type = {
let Some(schema) = app_data
.metadata
.openapi
.pointer(&output_type_ref[1..])
.clone()
else {
tracing::error!("no schema found for {}, skipping endpoint", output_type_ref);
continue;
};
schema.clone()
};
let input_types = app_data.metadata.openapi["components"]["schemas"]
.as_object()
.unwrap()
.iter()
.map(|(_, schema)| schema.clone())
.collect::<Vec<_>>();
let docs = docs_from(&model, params);
let endpoint = format!("{owner}/{alias}{}", if path == "/" { "" } else { path });
// Insert into the tree
root.insert_path(
&full_path_parts,
&endpoint,
&fn_name,
params["post"].clone(),
input_types,
output_type,
docs,
);
}
tokio::time::sleep(std::time::Duration::from_millis(10)).await;
}
// Print the tree structure
root.print_tree(0);
// Write the module tree to files
write_module_to_files(&root, base_module_path, true).expect("Failed to write module files");
let mut manifest = Manifest::from_path("Cargo.toml").unwrap();
// Write initial root mod.rs with module declarations
let root_mod_content = match &root {
Node::Module { children, .. } => children
.iter()
.filter_map(|child| {
if let Node::Module { name, children } = child {
// Collect all child features recursively
let mut all_features = vec![format!("endpoints_{}", name.replace("_", "-"))];
// Helper function to collect child features
fn collect_child_features(node: &Node, features: &mut Vec<String>, parent_name: &str) {
if let Node::Module { name, children } = node {
let current_name = format!("{}_{}", parent_name, name.replace("_", "-"));
features.push(current_name.clone());
for child in children {
collect_child_features(child, features, &current_name);
}
}
}
// Collect features from all children
for child in children {
collect_child_features(child, &mut all_features, &format!("endpoints_{}", name.replace("_", "-")));
}
// Create the feature gates string with all features
let features_str = all_features
.into_iter()
.filter(|f| f.chars().filter(|c| *c == '_').count() <= 2)
.map(|f| format!("feature = \"{}\"", f))
.collect::<Vec<_>>()
.join(", ");
Some(format!(
"#[cfg(any(feature = \"endpoints\", {}))]\n#[cfg_attr(docsrs, doc(cfg(any(feature = \"endpoints\", {}))))]\npub mod {};",
features_str,
features_str,
name
))
} else {
None
}
})
.collect::<Vec<_>>()
.join("\n"),
_ => String::new(),
};
std::fs::write(format!("{}/mod.rs", base_module_path), root_mod_content)
.expect("Failed to write root mod.rs");
update_manifest_features(&mut manifest, &root, "");
let new_manifest = toml::to_string_pretty(&manifest).unwrap();
std::fs::write("Cargo.toml", new_manifest).unwrap();
}
fn update_manifest_features(manifest: &mut Manifest, node: &Node, parent_path: &str) {
// Remove all features that start with "endpoint"
if let Some(features) = &mut manifest.features {
features.retain(|name, _| !name.starts_with("endpoint"));
}
// Initialize features if not present
if manifest.features.is_none() {
manifest.features = Some(std::collections::BTreeMap::new());
}
// Add base endpoints feature
if let Some(features) = &mut manifest.features {
features.insert("endpoints".to_string(), vec![]);
}
// Recursively add features for each module
add_module_features(manifest, node, parent_path);
}
fn add_module_features(manifest: &mut Manifest, node: &Node, parent_path: &str) {
match node {
Node::Module { name, children } => {
let current_path = if parent_path.is_empty() {
name.clone()
} else {
format!("{}_{}", parent_path, name.replace("_", "-"))
};
// Count segments to determine depth
let segments: Vec<&str> = current_path.split('_').collect();
// Only add feature if we haven't exceeded 3 levels and we're not at the root level
if segments.len() <= 3 {
// We want endpoints_fal-ai_dreamshaper but not deeper
// Add feature for current module
if let Some(features) = &mut manifest.features {
features.insert(current_path.clone(), vec![]);
}
}
// Recurse into children
for child in children {
add_module_features(manifest, child, &current_path);
}
}
Node::Leaf { .. } => {
// Leaf nodes don't need features
}
}
}
+309
View File
@@ -0,0 +1,309 @@
use std::collections::HashMap;
use crate::types::schema_type_to_rust_type;
pub enum Node {
Module {
name: String,
children: Vec<Node>,
},
Leaf {
endpoint: String,
fn_name: String,
definition: serde_json::Value,
module_types: Vec<serde_json::Value>,
output_type: serde_json::Value,
docs: String,
},
}
impl Node {
pub fn insert_path(
&mut self,
path_parts: &[&str],
endpoint: &str,
fn_name: &str,
definition: serde_json::Value,
module_types: Vec<serde_json::Value>,
output_type: serde_json::Value,
docs: String,
) {
match self {
Node::Module { children, .. } => {
if path_parts.is_empty() {
children.push(Node::Leaf {
endpoint: endpoint.to_string(),
fn_name: fn_name.to_string(),
definition,
module_types,
output_type,
docs,
});
return;
}
let current = path_parts[0];
let remaining = &path_parts[1..];
// Find or create the child module
if let Some(child) = children.iter_mut().find(|n| match n {
Node::Module { name, .. } => name == current,
_ => false,
}) {
child.insert_path(
remaining,
endpoint,
fn_name,
definition,
module_types,
output_type,
docs,
);
} else {
let mut new_module = Node::Module {
name: current.to_string(),
children: Vec::new(),
};
new_module.insert_path(
remaining,
endpoint,
fn_name,
definition,
module_types,
output_type,
docs,
);
children.push(new_module);
}
}
Node::Leaf { .. } => panic!("Cannot insert into a leaf node"),
}
}
pub fn print_tree(&self, indent: usize) {
match self {
Node::Module { name, children } => {
tracing::trace!("{}Module: {}", " ".repeat(indent), name);
for child in children {
child.print_tree(indent + 2);
}
}
Node::Leaf { fn_name, .. } => {
tracing::trace!("{}Function: {}", " ".repeat(indent), fn_name);
}
}
}
}
pub fn write_module_to_files(node: &Node, base_path: &str, is_root: bool) -> std::io::Result<()> {
match node {
Node::Module { name, children } => {
let module_path = if is_root {
base_path.to_string()
} else {
format!("{}/{}", base_path, name)
};
// Create directory if it doesn't exist
std::fs::create_dir_all(&module_path)?;
// Start with an empty string for mod content
let mut mod_content = String::new();
// Get direct child functions and modules
let (functions, modules): (Vec<_>, Vec<_>) = children
.iter()
.partition(|child| matches!(child, Node::Leaf { .. }));
// Add use declarations if we have direct functions/types
if !functions.is_empty() {
mod_content
.push_str("#[allow(unused_imports)]\nuse std::collections::HashMap;\n#[allow(unused_imports)]\nuse serde::{Serialize, Deserialize};\n#[allow(unused_imports)]\nuse crate::prelude::*;\n\n");
}
// Add pub mod declarations for child modules
let mut has_child_modules = false;
for child in &modules {
if let Node::Module {
name: child_name, ..
} = child
{
has_child_modules = true;
let mut path_segments: Vec<String> = module_path
.split('/')
.map(|s| s.replace("_", "-"))
.collect();
path_segments.remove(0); // remove "src"
// Helper function to collect all descendant features
fn collect_all_features(node: &Node, base_path: &[String]) -> Vec<String> {
let mut features = Vec::new();
match node {
Node::Module { name, children: _ } => {
let mut current_path = base_path.to_vec();
current_path.push(name.replace("_", "-"));
let mut feature_path = vec![];
// Add each level of the path up to 3 levels
for segment in current_path.iter().take(3) {
feature_path.push(segment.clone());
features.push(feature_path.join("_"));
}
}
Node::Leaf { .. } => {}
}
features
}
// Collect all features from this module and all its descendants
let mut all_features = collect_all_features(child, &path_segments);
// Sort and deduplicate features
all_features.sort();
all_features.dedup();
// Create the feature gates string with all features
let feature_cfg = if !all_features.is_empty() {
let features_map = all_features
.into_iter()
.map(|f| format!("feature = \"{}\"", f))
.collect::<Vec<String>>()
.join(", ");
format!(
"#[cfg(any({features_map}))]\n#[cfg_attr(docsrs, doc(cfg(any({features_map}))))]",
)
} else {
String::new()
};
let module_decl = if feature_cfg.is_empty() {
format!("pub mod {};\n", child_name)
} else {
format!("{}\npub mod {};\n", feature_cfg, child_name)
};
mod_content.push_str(&module_decl);
}
}
// Add a newline after module declarations if we have both modules and content
if has_child_modules && !functions.is_empty() {
mod_content.push_str("\n");
}
// Add direct functions and types
if !functions.is_empty() {
for child in functions {
mod_content.push_str(&generate_request_module(child));
}
}
// Write mod.rs
std::fs::write(format!("{}/mod.rs", module_path), mod_content)?;
// Recursively handle child modules
for child in modules {
if let Node::Module { .. } = child {
write_module_to_files(child, &module_path, false)?;
}
}
}
Node::Leaf { .. } => {
// Leaf nodes are handled within their parent module's mod.rs
}
}
Ok(())
}
pub fn generate_request_module(node: &Node) -> String {
match node {
Node::Module { name, children } => {
format!(
r#"
pub mod {name} {{
use super::*;
{}
}}
"#,
children
.iter()
.map(|child| generate_request_module(child))
.collect::<Vec<String>>()
.join("\n")
)
}
Node::Leaf {
endpoint,
fn_name,
definition,
module_types: input_types,
output_type,
docs,
} => {
let request_type_name = definition["requestBody"]["content"]["application/json"]
["schema"]["$ref"]
.as_str()
.unwrap()
.split("/")
.last()
.unwrap();
let return_type = output_type["title"].as_str().unwrap();
let mut extra_types = HashMap::new();
let mut input_types = input_types.clone();
input_types.sort_by_key(|ty| ty["title"].as_str().unwrap().to_owned());
let input_structs = input_types
.iter()
.map(|input_type| {
schema_type_to_rust_type(
input_type,
&mut extra_types,
input_type["title"].as_str().unwrap_or_default() != return_type,
)
})
.collect::<Vec<String>>()
.join("\n");
let mut extra_types = extra_types.into_iter().collect::<Vec<_>>();
extra_types.sort_by_key(|(k, _)| k.clone());
let extra_types_str = extra_types
.into_iter()
.map(|(_, (_, item))| item)
.collect::<Vec<String>>()
.join("\n\n");
let docs = docs
.trim()
.split("\n")
.map(|line| line.trim())
.map(|line| format!("/// {line}"))
.collect::<Vec<String>>()
.join("\n");
format!(
r#"
{input_structs}
{extra_types_str}
{docs}
pub fn {fn_name}(params: {request_type_name}) -> FalRequest<{request_type_name}, {return_type}> {{
FalRequest::new(
"{endpoint}",
params
)
}}
"#,
)
}
}
}
+292
View File
@@ -0,0 +1,292 @@
use std::collections::HashMap;
use crate::fal_data::Model;
use crate::helpers::*;
pub fn schema_type_to_rust_type(
info: &serde_json::Value,
extra_types: &mut HashMap<String, (String, String)>,
input_type: bool,
) -> String {
let type_name = info["title"].as_str().unwrap().replace(" ", "");
let params = info["properties"]
.as_object()
.unwrap()
.iter()
.map(|(k, v)| {
let is_required = info["required"]
.as_array()
.map(|a| a.contains(&serde_json::Value::String(k.to_string())))
.unwrap_or(false);
let prefix = if k == "type" {
"#[serde(rename = \"type\")]\npub ty:".to_owned()
} else if is_rust_keyword(k) {
format!("#[serde(rename = \"{k}\")]\npub r#{k}:")
} else {
let prop_name = to_snake_case(&k);
format!("pub {prop_name}:")
};
let serialization_attr = if !is_required {
"#[serde(skip_serializing_if = \"Option::is_none\")]\n"
} else {
""
};
let description = v["description"].as_str().unwrap_or("");
let examples = v["examples"].as_array();
let docs = if !description.is_empty() {
let description = description
.trim()
.split("\n")
.map(|line| line.trim())
.map(|line| format!("/// {line}"))
.collect::<Vec<String>>()
.join("\n");
if let Some(examples) = examples {
let examples = examples
.iter()
.map(|e| serde_json::to_string(e).unwrap())
.map(|line| format!("/// {line}"))
.collect::<Vec<String>>()
.join("\n");
format!("{description}\n{examples}\n")
} else {
format!("{description}\n")
}
} else {
"".to_string()
};
format!(
"{docs}{serialization_attr}{prefix} {}",
schema_property_to_rust_type(v, is_required, extra_types,)
)
})
.collect::<Vec<String>>()
.join(",\n");
let default_derive = if input_type { ", Default" } else { "" };
format!(
r#"
#[derive(Debug, Serialize, Deserialize{default_derive})]
pub struct {type_name} {{
{params}
}}
"#
)
}
pub fn schema_property_to_rust_type(
property: &serde_json::Value,
required: bool,
extra_types: &mut HashMap<String, (String, String)>,
) -> String {
let type_name = match property["type"].as_str() {
Some("string") => "String".to_string(),
Some("number") => "f64".to_string(),
Some("integer") => "i64".to_string(),
Some("boolean") => "bool".to_string(),
Some("object") => {
if property["additionalProperties"].as_object().is_some() {
if let Some(title) = property["title"].as_str() {
get_or_build_object_type(title, property, extra_types)
} else {
tracing::warn!("[additionalProperties] no title for object: {:?}", property);
"HashMap<String, serde_json::Value>".to_string()
}
} else {
"HashMap<String, serde_json::Value>".to_string()
}
}
Some("array") => {
format!(
"Vec<{}>",
schema_property_to_rust_type(&property["items"], required, extra_types)
)
}
_ => {
if let Some(reference) = property["$ref"].as_str() {
reference.split("/").last().unwrap().to_string()
} else if let Some(all_of) = property["allOf"].as_array() {
// fal API uses these to rename types usually, we should be able to just grab the first (only) element
if all_of.len() != 1 {
tracing::warn!("allOf != 1 element: {:?}", all_of);
}
let first_element = all_of.first().unwrap();
schema_property_to_rust_type(first_element, required, extra_types)
} else if let Some(one_of) = property["oneOf"].as_array() {
if one_of.len() == 1 {
schema_property_to_rust_type(one_of.first().unwrap(), required, extra_types)
} else {
if let Some(title) = property["title"].as_str() {
get_or_build_enum(title, one_of, extra_types)
} else {
tracing::warn!("no title for oneOf: {:?}", property);
"serde_json::Value".to_string()
}
}
} else if let Some(any_of) = property["anyOf"].as_array() {
if any_of.len() == 1 {
schema_property_to_rust_type(any_of.first().unwrap(), required, extra_types)
} else {
if let Some(title) = property["title"].as_str() {
// technically this is not correct per OpenAPI spec,
// but I don't think this is being used correctly in fal anyways
get_or_build_enum(title, any_of, extra_types)
} else {
tracing::warn!("no title for anyOf: {:?}", property);
"serde_json::Value".to_string()
}
}
} else {
tracing::warn!("Unsupported type: {:?}", property);
"serde_json::Value".to_string()
}
}
};
if required {
format!("{}", type_name)
} else {
format!("Option<{}>", type_name)
}
}
// handle oneOf
pub fn get_or_build_enum(
title: &str,
options: &[serde_json::Value],
extra_types: &mut HashMap<String, (String, String)>,
) -> String {
let mut enum_name = title.to_string();
enum_name = enum_name
.replace(".", "_")
.replace("-", "_")
.replace(" ", "");
enum_name = format!("{}Property", enum_name);
if let Some((existing_type, _)) = extra_types.get(&enum_name) {
existing_type.clone()
} else {
let variants = options
.iter()
.enumerate()
.map(|(i, v)| {
if let Some(enum_options) = v["enum"].as_array() {
enum_options
.iter()
.enumerate()
.map(|(j, op)| {
let mut variant_name =
snake_to_upper_camel(op.as_str().unwrap()).replace(":", "_");
if variant_name
.chars()
.next()
.map_or(false, |c| c.is_digit(10))
{
let prefix = v["title"]
.as_str()
.map(|s| snake_to_upper_camel(s))
.unwrap_or("Property".to_string());
variant_name = format!("{prefix}_{variant_name}");
}
let original_name = op.as_str().unwrap();
let default_marker = if i == 0 && j == 0 { "#[default]\n" } else { "" };
format!("{default_marker}#[serde(rename=\"{original_name}\")]\n{variant_name}")
})
.collect()
} else {
let variant_name =
if let Some(title) = v["title"].as_str() {
title.to_string()
} else if let Some(reference) = v["$ref"].as_str() {
reference.split("/").last().unwrap().to_string()
} else {
tracing::warn!("no title for oneOf: {:?}", v);
snake_to_upper_camel(v["type"].as_str().expect(
"if you don't have a title, you have to have a basic type =(",
))
};
let variant_name = variant_name
.replace(".", "_")
.replace("-", "_")
.replace(" ", "");
let variant_type = schema_property_to_rust_type(v, true, extra_types);
let default_marker = if i == 0 { "#[default]\n" } else { "" };
vec![format!("{default_marker}{variant_name}({variant_type})")]
}
})
.flatten()
.collect::<Vec<String>>()
.join(",\n");
let enum_type = format!(
"#[derive(Debug, Serialize, Deserialize, smart_default::SmartDefault)]\n#[allow(non_camel_case_types)]\npub enum {enum_name}\n{{\n{variants}\n}}"
);
extra_types.insert(enum_name.clone(), (enum_name.clone(), enum_type.clone()));
enum_name
}
}
pub fn get_or_build_object_type(
title: &str,
property: &serde_json::Value,
extra_types: &mut HashMap<String, (String, String)>,
) -> String {
let mut struct_name = title.to_string();
struct_name = struct_name
.replace(".", "_")
.replace("-", "_")
.replace(" ", "");
if let Some((name, _)) = extra_types.get(&struct_name) {
name.clone()
} else {
let mut property = property.clone();
property["properties"] = property["additionalProperties"].clone();
let struct_impl = schema_type_to_rust_type(&property, extra_types, true);
extra_types.insert(struct_name.clone(), (struct_name.clone(), struct_impl));
struct_name
}
}
pub fn docs_from(model: &Model, openapi_params: &serde_json::Value) -> String {
let openapi_description = openapi_params["post"]["description"].as_str().unwrap_or("");
let title = &model.title;
let category = &model.category;
let machine_type = model
.machine_type
.as_ref()
.map(|s| format!("Machine Type: {s}"))
.unwrap_or("".to_string());
let license_type = model
.license_type
.as_ref()
.map(|s| format!("License Type: {s}"))
.unwrap_or("".to_string());
format!(
"
{title}
Category: {category}
{machine_type}
{license_type}
{openapi_description}
"
)
}
@@ -0,0 +1,107 @@
#[allow(unused_imports)]
use crate::prelude::*;
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::collections::HashMap;
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct HTTPValidationError {
#[serde(skip_serializing_if = "Option::is_none")]
pub detail: Option<Vec<Option<ValidationError>>>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Image {
/// The mime type of the file.
/// "image/png"
#[serde(skip_serializing_if = "Option::is_none")]
pub content_type: Option<String>,
/// File data
#[serde(skip_serializing_if = "Option::is_none")]
pub file_data: Option<String>,
/// The name of the file. It will be auto-generated if not provided.
/// "z9RV14K95DvU.png"
#[serde(skip_serializing_if = "Option::is_none")]
pub file_name: Option<String>,
/// The size of the file in bytes.
/// 4404019
#[serde(skip_serializing_if = "Option::is_none")]
pub file_size: Option<i64>,
/// The height of the image in pixels.
/// 1024
#[serde(skip_serializing_if = "Option::is_none")]
pub height: Option<i64>,
/// The URL where the file can be downloaded from.
pub url: String,
/// The width of the image in pixels.
/// 1024
#[serde(skip_serializing_if = "Option::is_none")]
pub width: Option<i64>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct MirrorInput {
/// User's face image to face swap FROM
/// "https://images.easelai.com/mirror_fal/faces/dr.webp"
/// "https://images.easelai.com/mirror_fal/faces/ew.jpg"
/// "https://images.easelai.com/mirror_fal/faces/me.jpg"
/// "https://images.easelai.com/mirror_fal/faces/chani.png"
pub face_image_0: Image,
/// (Optional) The Second face image to face swap FROM
/// "https://images.easelai.com/mirror_fal/faces/chani.png"
/// "https://images.easelai.com/mirror_fal/faces/ew.jpg"
/// "https://images.easelai.com/mirror_fal/faces/me.jpg"
/// "https://images.easelai.com/mirror_fal/faces/dr.webp"
#[serde(skip_serializing_if = "Option::is_none")]
pub face_image_1: Option<Option<Image>>,
/// The gender of the person in the face image.
pub gender_0: String,
/// The gender of the person in the second face image.
#[serde(skip_serializing_if = "Option::is_none")]
pub gender_1: Option<String>,
/// The target image to face swap TO
/// "https://images.easelai.com/mirror_fal/men_single_player/tg.jpg"
/// "https://images.easelai.com/mirror_fal/men_single_player/bh.png"
/// "https://images.easelai.com/mirror_fal/men_single_player/rip.jpg"
/// "https://images.easelai.com/mirror_fal/men_single_player/th.jpg"
/// "https://images.easelai.com/mirror_fal/women_single_player/themark.jpg"
/// "https://images.easelai.com/mirror_fal/women_single_player/yellow.jpg"
/// "https://images.easelai.com/mirror_fal/women_single_player/diamond.jpg"
/// "https://images.easelai.com/mirror_fal/women_single_player/barbie.png"
/// "https://images.easelai.com/mirror_fal/multiplayer/bf.jpg"
/// "https://images.easelai.com/mirror_fal/multiplayer/hm.png"
/// "https://images.easelai.com/mirror_fal/multiplayer/tr.jpg"
/// "https://images.easelai.com/mirror_fal/multiplayer/mc.jpg"
/// "https://images.easelai.com/mirror_fal/multiplayer/sb.jpg"
/// "https://images.easelai.com/mirror_fal/multiplayer/wf.webp"
pub target_image: Image,
/// Apply 2x upscale and boost quality. Upscaling will refine the image and make the subjects brighter.
#[serde(skip_serializing_if = "Option::is_none")]
pub upscale: Option<bool>,
/// The type of face swap workflow. target_hair = preserve target's hair. user_hair = preserve user's hair.
pub workflow_type: String,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct MirrorOutput {
/// The mirrored image.
pub image: Image,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ValidationError {
pub loc: Vec<serde_json::Value>,
pub msg: String,
#[serde(rename = "type")]
pub ty: String,
}
/// Easel AI Advanced Face Swap
///
/// Category: image-to-image
/// Machine Type: H100
/// License Type: commercial
pub fn advanced_face_swap(params: MirrorInput) -> FalRequest<MirrorInput, MirrorOutput> {
FalRequest::new("easel-ai/advanced-face-swap", params)
}
+14
View File
@@ -0,0 +1,14 @@
#[cfg(any(
feature = "endpoints",
feature = "endpoints_easel-ai",
feature = "endpoints_easel-ai_advanced-face-swap"
))]
#[cfg_attr(
docsrs,
doc(cfg(any(
feature = "endpoints",
feature = "endpoints_easel-ai",
feature = "endpoints_easel-ai_advanced-face-swap"
)))
)]
pub mod advanced_face_swap;
@@ -0,0 +1,89 @@
#[allow(unused_imports)]
use crate::prelude::*;
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::collections::HashMap;
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct AMTFrameInterpolationInput {
/// Frames to interpolate
/// [{"url":"https://storage.googleapis.com/falserverless/model_tests/amt-interpolation/start.png"},{"url":"https://storage.googleapis.com/falserverless/model_tests/amt-interpolation/end.png"}]
pub frames: Vec<Frame>,
/// Output frames per second
#[serde(skip_serializing_if = "Option::is_none")]
pub output_fps: Option<i64>,
/// Number of recursive interpolation passes
#[serde(skip_serializing_if = "Option::is_none")]
pub recursive_interpolation_passes: Option<i64>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct AMTInterpolationInput {
/// Output frames per second
#[serde(skip_serializing_if = "Option::is_none")]
pub output_fps: Option<i64>,
/// Number of recursive interpolation passes
#[serde(skip_serializing_if = "Option::is_none")]
pub recursive_interpolation_passes: Option<i64>,
/// URL of the video to be processed
/// "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/animatediff-vid2vid-input-2.gif"
pub video_url: String,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct AMTInterpolationOutput {
/// Generated video
pub video: File,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct File {
/// The mime type of the file.
/// "image/png"
#[serde(skip_serializing_if = "Option::is_none")]
pub content_type: Option<String>,
/// File data
#[serde(skip_serializing_if = "Option::is_none")]
pub file_data: Option<String>,
/// The name of the file. It will be auto-generated if not provided.
/// "z9RV14K95DvU.png"
#[serde(skip_serializing_if = "Option::is_none")]
pub file_name: Option<String>,
/// The size of the file in bytes.
/// 4404019
#[serde(skip_serializing_if = "Option::is_none")]
pub file_size: Option<i64>,
/// The URL where the file can be downloaded from.
pub url: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Frame {
/// URL of the frame
pub url: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct HTTPValidationError {
#[serde(skip_serializing_if = "Option::is_none")]
pub detail: Option<Vec<Option<ValidationError>>>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ValidationError {
pub loc: Vec<serde_json::Value>,
pub msg: String,
#[serde(rename = "type")]
pub ty: String,
}
/// AMT Interpolation
///
/// Category: video-to-video
/// Machine Type: A6000
pub fn frame_interpolation(
params: AMTFrameInterpolationInput,
) -> FalRequest<AMTFrameInterpolationInput, AMTInterpolationOutput> {
FalRequest::new("fal-ai/amt-interpolation/frame-interpolation", params)
}
@@ -0,0 +1,104 @@
#[allow(unused_imports)]
use crate::prelude::*;
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::collections::HashMap;
#[cfg(any(
feature = "endpoints",
feature = "endpoints_fal-ai",
feature = "endpoints_fal-ai_amt-interpolation"
))]
#[cfg_attr(
docsrs,
doc(cfg(any(
feature = "endpoints",
feature = "endpoints_fal-ai",
feature = "endpoints_fal-ai_amt-interpolation"
)))
)]
pub mod frame_interpolation;
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct AMTFrameInterpolationInput {
/// Frames to interpolate
/// [{"url":"https://storage.googleapis.com/falserverless/model_tests/amt-interpolation/start.png"},{"url":"https://storage.googleapis.com/falserverless/model_tests/amt-interpolation/end.png"}]
pub frames: Vec<Frame>,
/// Output frames per second
#[serde(skip_serializing_if = "Option::is_none")]
pub output_fps: Option<i64>,
/// Number of recursive interpolation passes
#[serde(skip_serializing_if = "Option::is_none")]
pub recursive_interpolation_passes: Option<i64>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct AMTInterpolationInput {
/// Output frames per second
#[serde(skip_serializing_if = "Option::is_none")]
pub output_fps: Option<i64>,
/// Number of recursive interpolation passes
#[serde(skip_serializing_if = "Option::is_none")]
pub recursive_interpolation_passes: Option<i64>,
/// URL of the video to be processed
/// "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/animatediff-vid2vid-input-2.gif"
pub video_url: String,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct AMTInterpolationOutput {
/// Generated video
pub video: File,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct File {
/// The mime type of the file.
/// "image/png"
#[serde(skip_serializing_if = "Option::is_none")]
pub content_type: Option<String>,
/// File data
#[serde(skip_serializing_if = "Option::is_none")]
pub file_data: Option<String>,
/// The name of the file. It will be auto-generated if not provided.
/// "z9RV14K95DvU.png"
#[serde(skip_serializing_if = "Option::is_none")]
pub file_name: Option<String>,
/// The size of the file in bytes.
/// 4404019
#[serde(skip_serializing_if = "Option::is_none")]
pub file_size: Option<i64>,
/// The URL where the file can be downloaded from.
pub url: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Frame {
/// URL of the frame
pub url: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct HTTPValidationError {
#[serde(skip_serializing_if = "Option::is_none")]
pub detail: Option<Vec<Option<ValidationError>>>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ValidationError {
pub loc: Vec<serde_json::Value>,
pub msg: String,
#[serde(rename = "type")]
pub ty: String,
}
/// AMT Interpolation
///
/// Category: video-to-video
/// Machine Type: A6000
pub fn amt_interpolation(
params: AMTInterpolationInput,
) -> FalRequest<AMTInterpolationInput, AMTInterpolationOutput> {
FalRequest::new("fal-ai/amt-interpolation", params)
}
@@ -0,0 +1,103 @@
#[allow(unused_imports)]
use crate::prelude::*;
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::collections::HashMap;
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct AnimatediffLCMInput {
/// The type of controlnet to use for generating the video. The controlnet determines how the video will be animated.
#[serde(skip_serializing_if = "Option::is_none")]
pub controlnet_type: Option<String>,
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want the model to stick to your prompt when looking for a related image to show you.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance_scale: Option<i64>,
/// The URL of the first keyframe to use for the generation.
/// "https://storage.googleapis.com/falserverless/scribble2/scribble_2_1.png"
#[serde(skip_serializing_if = "Option::is_none")]
pub keyframe_0_image_url: Option<String>,
/// The frame index of the first keyframe to use for the generation.
/// 0
#[serde(skip_serializing_if = "Option::is_none")]
pub keyframe_0_index: Option<i64>,
/// The URL of the second keyframe to use for the generation.
/// "https://storage.googleapis.com/falserverless/scribble2/scribble_2_2.png"
#[serde(skip_serializing_if = "Option::is_none")]
pub keyframe_1_image_url: Option<String>,
/// The frame index of the second keyframe to use for the generation.
/// 8
#[serde(skip_serializing_if = "Option::is_none")]
pub keyframe_1_index: Option<i64>,
/// The URL of the third keyframe to use for the generation.
/// "https://storage.googleapis.com/falserverless/scribble2/scribble_2_3.png"
#[serde(skip_serializing_if = "Option::is_none")]
pub keyframe_2_image_url: Option<String>,
/// The frame index of the third keyframe to use for the generation.
/// 15
#[serde(skip_serializing_if = "Option::is_none")]
pub keyframe_2_index: Option<i64>,
/// The negative prompt to use. Use it to specify what you don't want.
/// "blurry, low resolution, bad, ugly, low quality, pixelated, interpolated, compression artifacts, noisey, grainy"
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// Increasing the amount of steps tells Stable Diffusion that it should take more steps to generate your final result which can increase the amount of detail in your image.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// The prompt to use for generating the image. Be as descriptive as possible for best results.
/// "Drone footage, futuristic city at night, synthwave, vaporware, neon lights, highly detailed, masterpeice, high quality"
pub prompt: String,
/// The same seed and the same prompt given to the same version of Stable
/// Diffusion will output the same image every time.
/// 42
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct AnimatediffLCMOutput {
/// The seed used to generate the video.
pub seed: i64,
/// Generated video file.
pub video: File,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct File {
/// The mime type of the file.
/// "image/png"
pub content_type: String,
/// The name of the file. It will be auto-generated if not provided.
/// "z9RV14K95DvU.png"
pub file_name: String,
/// The size of the file in bytes.
/// 4404019
pub file_size: i64,
/// The URL where the file can be downloaded from.
/// "https://url.to/generated/file/z9RV14K95DvU.png"
pub url: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct HTTPValidationError {
#[serde(skip_serializing_if = "Option::is_none")]
pub detail: Option<Vec<Option<ValidationError>>>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ValidationError {
pub loc: Vec<serde_json::Value>,
pub msg: String,
#[serde(rename = "type")]
pub ty: String,
}
/// Animatediff SparseCtrl LCM
///
/// Category: text-to-video
/// Machine Type: A100
pub fn animatediff_sparsectrl_lcm(
params: AnimatediffLCMInput,
) -> FalRequest<AnimatediffLCMInput, AnimatediffLCMOutput> {
FalRequest::new("fal-ai/animatediff-sparsectrl-lcm", params)
}
@@ -0,0 +1,180 @@
#[allow(unused_imports)]
use crate::prelude::*;
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::collections::HashMap;
#[cfg(any(
feature = "endpoints",
feature = "endpoints_fal-ai",
feature = "endpoints_fal-ai_animatediff-v2v"
))]
#[cfg_attr(
docsrs,
doc(cfg(any(
feature = "endpoints",
feature = "endpoints_fal-ai",
feature = "endpoints_fal-ai_animatediff-v2v"
)))
)]
pub mod turbo;
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct AnimateDiffV2VInput {
/// Base model to use for animation generation.
#[serde(skip_serializing_if = "Option::is_none")]
pub base_model: Option<String>,
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want
/// the model to stick to your prompt when looking for a related image to show you.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance_scale: Option<f64>,
/// The list of LoRA weights to use.
#[serde(skip_serializing_if = "Option::is_none")]
pub loras: Option<Vec<Option<LoraWeight>>>,
/// The negative prompt to use. Use it to address details that you don't want
/// in the image. This could be colors, objects, scenery and even the small details
/// (e.g. moustache, blurry, low resolution).
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// Increasing the amount of steps tells Stable Diffusion that it should take more steps
/// to generate your final result which can increase the amount of detail in your image.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// The prompt to use for generating the image. Be as descriptive as possible for best results.
/// "masterpiece, best quality, rocket in space, galaxies in the background"
pub prompt: String,
/// The same seed and the same prompt given to the same version of Stable Diffusion
/// will output the same image every time.
/// 537306
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// Select every Nth frame from the video.
/// This can be used to reduce the number of frames to process, which can reduce the time and the cost.
/// However, it can also reduce the quality of the final video.
#[serde(skip_serializing_if = "Option::is_none")]
pub select_every_nth_frame: Option<i64>,
/// URL of the video.
/// "https://storage.googleapis.com/falserverless/model_tests/animatediff_v2v/rocket.mp4"
pub video_url: String,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct AnimateDiffV2VOutput {
/// Seed used for generating the video.
pub seed: i64,
pub timings: Timings,
/// Generated video file.
/// {"content_type":"video/mp4","url":"https://storage.googleapis.com/falserverless/model_tests/animatediff_v2v/turbo-rocket-output.mp4"}
pub video: File,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct AnimateDiffV2VTurboInput {
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want
/// the model to stick to your prompt when looking for a related image to show you.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance_scale: Option<f64>,
/// The list of LoRA weights to use.
#[serde(skip_serializing_if = "Option::is_none")]
pub loras: Option<Vec<Option<LoraWeight>>>,
/// The negative prompt to use. Use it to address details that you don't want
/// in the image. This could be colors, objects, scenery and even the small details
/// (e.g. moustache, blurry, low resolution).
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// Increasing the amount of steps tells Stable Diffusion that it should take more steps
/// to generate your final result which can increase the amount of detail in your image.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// The prompt to use for generating the image. Be as descriptive as possible for best results.
/// "masterpiece, best quality, rocket in space, galaxies in the background"
pub prompt: String,
/// The same seed and the same prompt given to the same version of Stable Diffusion
/// will output the same image every time.
/// 537306
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// Select every Nth frame from the video.
/// This can be used to reduce the number of frames to process, which can reduce the time and the cost.
/// However, it can also reduce the quality of the final video.
#[serde(skip_serializing_if = "Option::is_none")]
pub select_every_nth_frame: Option<i64>,
/// URL of the video.
/// "https://storage.googleapis.com/falserverless/model_tests/animatediff_v2v/rocket.mp4"
pub video_url: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct AnimateDiffV2VTurboOutput {
/// Seed used for generating the video.
pub seed: i64,
pub timings: Timings,
/// Generated video file.
/// {"content_type":"video/mp4","url":"https://storage.googleapis.com/falserverless/model_tests/animatediff_v2v/rocket-output.mp4"}
pub video: File,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct File {
/// The mime type of the file.
/// "image/png"
#[serde(skip_serializing_if = "Option::is_none")]
pub content_type: Option<String>,
/// File data
#[serde(skip_serializing_if = "Option::is_none")]
pub file_data: Option<String>,
/// The name of the file. It will be auto-generated if not provided.
/// "z9RV14K95DvU.png"
#[serde(skip_serializing_if = "Option::is_none")]
pub file_name: Option<String>,
/// The size of the file in bytes.
/// 4404019
#[serde(skip_serializing_if = "Option::is_none")]
pub file_size: Option<i64>,
/// The URL where the file can be downloaded from.
pub url: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct HTTPValidationError {
#[serde(skip_serializing_if = "Option::is_none")]
pub detail: Option<Vec<Option<ValidationError>>>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct LoraWeight {
/// URL or the path to the LoRA weights. Or HF model name.
/// "https://civitai.com/api/download/models/135931"
/// "https://filebin.net/3chfqasxpqu21y8n/my-custom-lora-v1.safetensors"
pub path: String,
/// The scale of the LoRA weight. This is used to scale the LoRA weight
/// before merging it with the base model.
#[serde(skip_serializing_if = "Option::is_none")]
pub scale: Option<f64>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ValidationError {
pub loc: Vec<serde_json::Value>,
pub msg: String,
#[serde(rename = "type")]
pub ty: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Timings {
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(rename = "type")]
pub ty: Option<serde_json::Value>,
}
/// AnimateDiff Video-to-Video Evolved
///
/// Category: video-to-video
/// Machine Type: A100
pub fn animatediff_v2v(
params: AnimateDiffV2VInput,
) -> FalRequest<AnimateDiffV2VInput, AnimateDiffV2VOutput> {
FalRequest::new("fal-ai/animatediff-v2v", params)
}
@@ -0,0 +1,165 @@
#[allow(unused_imports)]
use crate::prelude::*;
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::collections::HashMap;
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct AnimateDiffV2VInput {
/// Base model to use for animation generation.
#[serde(skip_serializing_if = "Option::is_none")]
pub base_model: Option<String>,
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want
/// the model to stick to your prompt when looking for a related image to show you.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance_scale: Option<f64>,
/// The list of LoRA weights to use.
#[serde(skip_serializing_if = "Option::is_none")]
pub loras: Option<Vec<Option<LoraWeight>>>,
/// The negative prompt to use. Use it to address details that you don't want
/// in the image. This could be colors, objects, scenery and even the small details
/// (e.g. moustache, blurry, low resolution).
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// Increasing the amount of steps tells Stable Diffusion that it should take more steps
/// to generate your final result which can increase the amount of detail in your image.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// The prompt to use for generating the image. Be as descriptive as possible for best results.
/// "masterpiece, best quality, rocket in space, galaxies in the background"
pub prompt: String,
/// The same seed and the same prompt given to the same version of Stable Diffusion
/// will output the same image every time.
/// 537306
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// Select every Nth frame from the video.
/// This can be used to reduce the number of frames to process, which can reduce the time and the cost.
/// However, it can also reduce the quality of the final video.
#[serde(skip_serializing_if = "Option::is_none")]
pub select_every_nth_frame: Option<i64>,
/// URL of the video.
/// "https://storage.googleapis.com/falserverless/model_tests/animatediff_v2v/rocket.mp4"
pub video_url: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct AnimateDiffV2VOutput {
/// Seed used for generating the video.
pub seed: i64,
pub timings: Timings,
/// Generated video file.
/// {"content_type":"video/mp4","url":"https://storage.googleapis.com/falserverless/model_tests/animatediff_v2v/turbo-rocket-output.mp4"}
pub video: File,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct AnimateDiffV2VTurboInput {
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want
/// the model to stick to your prompt when looking for a related image to show you.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance_scale: Option<f64>,
/// The list of LoRA weights to use.
#[serde(skip_serializing_if = "Option::is_none")]
pub loras: Option<Vec<Option<LoraWeight>>>,
/// The negative prompt to use. Use it to address details that you don't want
/// in the image. This could be colors, objects, scenery and even the small details
/// (e.g. moustache, blurry, low resolution).
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// Increasing the amount of steps tells Stable Diffusion that it should take more steps
/// to generate your final result which can increase the amount of detail in your image.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// The prompt to use for generating the image. Be as descriptive as possible for best results.
/// "masterpiece, best quality, rocket in space, galaxies in the background"
pub prompt: String,
/// The same seed and the same prompt given to the same version of Stable Diffusion
/// will output the same image every time.
/// 537306
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// Select every Nth frame from the video.
/// This can be used to reduce the number of frames to process, which can reduce the time and the cost.
/// However, it can also reduce the quality of the final video.
#[serde(skip_serializing_if = "Option::is_none")]
pub select_every_nth_frame: Option<i64>,
/// URL of the video.
/// "https://storage.googleapis.com/falserverless/model_tests/animatediff_v2v/rocket.mp4"
pub video_url: String,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct AnimateDiffV2VTurboOutput {
/// Seed used for generating the video.
pub seed: i64,
pub timings: Timings,
/// Generated video file.
/// {"content_type":"video/mp4","url":"https://storage.googleapis.com/falserverless/model_tests/animatediff_v2v/rocket-output.mp4"}
pub video: File,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct File {
/// The mime type of the file.
/// "image/png"
#[serde(skip_serializing_if = "Option::is_none")]
pub content_type: Option<String>,
/// File data
#[serde(skip_serializing_if = "Option::is_none")]
pub file_data: Option<String>,
/// The name of the file. It will be auto-generated if not provided.
/// "z9RV14K95DvU.png"
#[serde(skip_serializing_if = "Option::is_none")]
pub file_name: Option<String>,
/// The size of the file in bytes.
/// 4404019
#[serde(skip_serializing_if = "Option::is_none")]
pub file_size: Option<i64>,
/// The URL where the file can be downloaded from.
pub url: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct HTTPValidationError {
#[serde(skip_serializing_if = "Option::is_none")]
pub detail: Option<Vec<Option<ValidationError>>>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct LoraWeight {
/// URL or the path to the LoRA weights. Or HF model name.
/// "https://civitai.com/api/download/models/135931"
/// "https://filebin.net/3chfqasxpqu21y8n/my-custom-lora-v1.safetensors"
pub path: String,
/// The scale of the LoRA weight. This is used to scale the LoRA weight
/// before merging it with the base model.
#[serde(skip_serializing_if = "Option::is_none")]
pub scale: Option<f64>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ValidationError {
pub loc: Vec<serde_json::Value>,
pub msg: String,
#[serde(rename = "type")]
pub ty: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Timings {
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(rename = "type")]
pub ty: Option<serde_json::Value>,
}
/// AnimateDiff Video-to-Video Evolved
///
/// Category: video-to-video
/// Machine Type: A100
pub fn turbo(
params: AnimateDiffV2VTurboInput,
) -> FalRequest<AnimateDiffV2VTurboInput, AnimateDiffV2VTurboOutput> {
FalRequest::new("fal-ai/animatediff-v2v/turbo", params)
}
+114
View File
@@ -0,0 +1,114 @@
#[allow(unused_imports)]
use crate::prelude::*;
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::collections::HashMap;
#[cfg(any(
feature = "endpoints",
feature = "endpoints_fal-ai",
feature = "endpoints_fal-ai_any-llm"
))]
#[cfg_attr(
docsrs,
doc(cfg(any(
feature = "endpoints",
feature = "endpoints_fal-ai",
feature = "endpoints_fal-ai_any-llm"
)))
)]
pub mod vision;
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ChatInput {
/// Name of the model to use. Premium models are charged at 10x the rate of standard models, they include: meta-llama/llama-3.2-90b-vision-instruct, openai/gpt-4o, anthropic/claude-3-5-haiku, google/gemini-pro-1.5, anthropic/claude-3.5-sonnet.
#[serde(skip_serializing_if = "Option::is_none")]
pub model: Option<String>,
/// Prompt to be used for the chat completion
/// "What is the meaning of life?"
pub prompt: String,
/// Should reasoning be the part of the final answer.
#[serde(skip_serializing_if = "Option::is_none")]
pub reasoning: Option<bool>,
/// System prompt to provide context or instructions to the model
#[serde(skip_serializing_if = "Option::is_none")]
pub system_prompt: Option<SystemPromptProperty>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct ChatOutput {
/// Error message if an error occurred
#[serde(skip_serializing_if = "Option::is_none")]
pub error: Option<ErrorProperty>,
/// Generated output
/// "The meaning of life is subjective and depends on individual perspectives."
pub output: String,
/// Whether the output is partial
#[serde(skip_serializing_if = "Option::is_none")]
pub partial: Option<bool>,
/// Generated reasoning for the final answer
#[serde(skip_serializing_if = "Option::is_none")]
pub reasoning: Option<String>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct HTTPValidationError {
#[serde(skip_serializing_if = "Option::is_none")]
pub detail: Option<Vec<Option<ValidationError>>>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ValidationError {
pub loc: Vec<serde_json::Value>,
pub msg: String,
#[serde(rename = "type")]
pub ty: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct VisionInput {
/// URL of the image to be processed
/// "https://fal.media/files/tiger/4Ew1xYW6oZCs6STQVC7V8_86440216d0fe42e4b826d03a2121468e.jpg"
pub image_url: String,
/// Name of the model to use. Premium models are charged at 3x the rate of standard models, they include: meta-llama/llama-3.2-90b-vision-instruct, openai/gpt-4o, anthropic/claude-3-5-haiku, google/gemini-pro-1.5, anthropic/claude-3.5-sonnet.
#[serde(skip_serializing_if = "Option::is_none")]
pub model: Option<String>,
/// Prompt to be used for the image
/// "Caption this image for a text-to-image model with as much detail as possible."
pub prompt: String,
/// Should reasoning be the part of the final answer.
#[serde(skip_serializing_if = "Option::is_none")]
pub reasoning: Option<bool>,
/// System prompt to provide context or instructions to the model
/// "Only answer the question, do not provide any additional information or add any prefix/suffix other than the answer of the original question. Don't use markdown."
#[serde(skip_serializing_if = "Option::is_none")]
pub system_prompt: Option<SystemPromptProperty>,
}
#[derive(Debug, Serialize, Deserialize, smart_default::SmartDefault)]
#[allow(non_camel_case_types)]
pub enum ErrorProperty {
#[default]
String(String),
Null(serde_json::Value),
}
#[derive(Debug, Serialize, Deserialize, smart_default::SmartDefault)]
#[allow(non_camel_case_types)]
pub enum SystemPromptProperty {
#[default]
String(String),
Null(serde_json::Value),
}
/// Any LLM
///
/// Category: llm
/// Machine Type: A6000
///
///
/// Run any large language model with fal, powered by [OpenRouter](https://openrouter.ai).
pub fn any_llm(params: ChatInput) -> FalRequest<ChatInput, ChatOutput> {
FalRequest::new("fal-ai/any-llm", params)
}
@@ -0,0 +1,99 @@
#[allow(unused_imports)]
use crate::prelude::*;
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::collections::HashMap;
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ChatInput {
/// Name of the model to use. Premium models are charged at 10x the rate of standard models, they include: meta-llama/llama-3.2-90b-vision-instruct, openai/gpt-4o, anthropic/claude-3-5-haiku, google/gemini-pro-1.5, anthropic/claude-3.5-sonnet.
#[serde(skip_serializing_if = "Option::is_none")]
pub model: Option<String>,
/// Prompt to be used for the chat completion
/// "What is the meaning of life?"
pub prompt: String,
/// Should reasoning be the part of the final answer.
#[serde(skip_serializing_if = "Option::is_none")]
pub reasoning: Option<bool>,
/// System prompt to provide context or instructions to the model
#[serde(skip_serializing_if = "Option::is_none")]
pub system_prompt: Option<SystemPromptProperty>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct ChatOutput {
/// Error message if an error occurred
#[serde(skip_serializing_if = "Option::is_none")]
pub error: Option<ErrorProperty>,
/// Generated output
/// "The meaning of life is subjective and depends on individual perspectives."
pub output: String,
/// Whether the output is partial
#[serde(skip_serializing_if = "Option::is_none")]
pub partial: Option<bool>,
/// Generated reasoning for the final answer
#[serde(skip_serializing_if = "Option::is_none")]
pub reasoning: Option<String>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct HTTPValidationError {
#[serde(skip_serializing_if = "Option::is_none")]
pub detail: Option<Vec<Option<ValidationError>>>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ValidationError {
pub loc: Vec<serde_json::Value>,
pub msg: String,
#[serde(rename = "type")]
pub ty: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct VisionInput {
/// URL of the image to be processed
/// "https://fal.media/files/tiger/4Ew1xYW6oZCs6STQVC7V8_86440216d0fe42e4b826d03a2121468e.jpg"
pub image_url: String,
/// Name of the model to use. Premium models are charged at 3x the rate of standard models, they include: meta-llama/llama-3.2-90b-vision-instruct, openai/gpt-4o, anthropic/claude-3-5-haiku, google/gemini-pro-1.5, anthropic/claude-3.5-sonnet.
#[serde(skip_serializing_if = "Option::is_none")]
pub model: Option<String>,
/// Prompt to be used for the image
/// "Caption this image for a text-to-image model with as much detail as possible."
pub prompt: String,
/// Should reasoning be the part of the final answer.
#[serde(skip_serializing_if = "Option::is_none")]
pub reasoning: Option<bool>,
/// System prompt to provide context or instructions to the model
/// "Only answer the question, do not provide any additional information or add any prefix/suffix other than the answer of the original question. Don't use markdown."
#[serde(skip_serializing_if = "Option::is_none")]
pub system_prompt: Option<SystemPromptProperty>,
}
#[derive(Debug, Serialize, Deserialize, smart_default::SmartDefault)]
#[allow(non_camel_case_types)]
pub enum ErrorProperty {
#[default]
String(String),
Null(serde_json::Value),
}
#[derive(Debug, Serialize, Deserialize, smart_default::SmartDefault)]
#[allow(non_camel_case_types)]
pub enum SystemPromptProperty {
#[default]
String(String),
Null(serde_json::Value),
}
/// Any LLM
///
/// Category: llm
/// Machine Type: A6000
///
///
/// Run any vision model with fal, powered by [OpenRouter](https://openrouter.ai).
pub fn vision(params: VisionInput) -> FalRequest<VisionInput, ChatOutput> {
FalRequest::new("fal-ai/any-llm/vision", params)
}
@@ -0,0 +1,90 @@
#[allow(unused_imports)]
use crate::prelude::*;
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::collections::HashMap;
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct HTTPValidationError {
#[serde(skip_serializing_if = "Option::is_none")]
pub detail: Option<Vec<Option<ValidationError>>>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Image {
/// The mime type of the file.
/// "image/png"
#[serde(skip_serializing_if = "Option::is_none")]
pub content_type: Option<String>,
/// File data
#[serde(skip_serializing_if = "Option::is_none")]
pub file_data: Option<String>,
/// The name of the file. It will be auto-generated if not provided.
/// "z9RV14K95DvU.png"
#[serde(skip_serializing_if = "Option::is_none")]
pub file_name: Option<String>,
/// The size of the file in bytes.
/// 4404019
#[serde(skip_serializing_if = "Option::is_none")]
pub file_size: Option<i64>,
/// The height of the image in pixels.
/// 1024
#[serde(skip_serializing_if = "Option::is_none")]
pub height: Option<i64>,
/// The URL where the file can be downloaded from.
pub url: String,
/// The width of the image in pixels.
/// 1024
#[serde(skip_serializing_if = "Option::is_none")]
pub width: Option<i64>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Input {
/// Whether to perform prompt expansion (recommended)
#[serde(skip_serializing_if = "Option::is_none")]
pub expand_prompt: Option<bool>,
/// Classifier free guidance scale
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance_scale: Option<f64>,
/// The number of images to generate
#[serde(skip_serializing_if = "Option::is_none")]
pub num_images: Option<i64>,
/// The number of inference steps to take
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// The prompt to generate images from
/// "Close-up portrait of a majestic iguana with vibrant blue-green scales, piercing amber eyes, and orange spiky crest. Intricate textures and details visible on scaly skin. Wrapped in dark hood, giving regal appearance. Dramatic lighting against black background. Hyper-realistic, high-resolution image showcasing the reptile's expressive features and coloration."
pub prompt: String,
/// The seed to use for generating images
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct Output {
/// The generated images
pub images: Vec<Image>,
/// The expanded prompt
pub prompt: String,
/// The seed used to generate the images
pub seed: i64,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ValidationError {
pub loc: Vec<serde_json::Value>,
pub msg: String,
#[serde(rename = "type")]
pub ty: String,
}
/// AuraFlow
///
/// Category: text-to-image
/// Machine Type: A100
/// License Type: commercial
pub fn aura_flow(params: Input) -> FalRequest<Input, Output> {
FalRequest::new("fal-ai/aura-flow", params)
}
@@ -0,0 +1,95 @@
#[allow(unused_imports)]
use crate::prelude::*;
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::collections::HashMap;
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct HTTPValidationError {
#[serde(skip_serializing_if = "Option::is_none")]
pub detail: Option<Vec<Option<ValidationError>>>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Image {
/// The mime type of the file.
/// "image/png"
#[serde(skip_serializing_if = "Option::is_none")]
pub content_type: Option<String>,
/// File data
#[serde(skip_serializing_if = "Option::is_none")]
pub file_data: Option<String>,
/// The name of the file. It will be auto-generated if not provided.
/// "z9RV14K95DvU.png"
#[serde(skip_serializing_if = "Option::is_none")]
pub file_name: Option<String>,
/// The size of the file in bytes.
/// 4404019
#[serde(skip_serializing_if = "Option::is_none")]
pub file_size: Option<i64>,
/// The height of the image in pixels.
/// 1024
#[serde(skip_serializing_if = "Option::is_none")]
pub height: Option<i64>,
/// The URL where the file can be downloaded from.
pub url: String,
/// The width of the image in pixels.
/// 1024
#[serde(skip_serializing_if = "Option::is_none")]
pub width: Option<i64>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Input {
/// Checkpoint to use for upscaling. More coming soon.
/// "v2"
/// "v1"
#[serde(skip_serializing_if = "Option::is_none")]
pub checkpoint: Option<String>,
/// URL of the image to upscale.
/// "https://fal.media/files/rabbit/JlBgYUyQRS3zxiBu_B4fM.png"
/// "https://fal.media/files/monkey/e6RtJf_ue0vyWzeiEmTby.png"
/// "https://fal.media/files/monkey/A6HGsigx4mmvs-hJVoOZX.png"
pub image_url: String,
/// Whether to use overlapping tiles for upscaling. Setting this to true helps remove seams but doubles the inference time.
/// true
/// false
#[serde(skip_serializing_if = "Option::is_none")]
pub overlapping_tiles: Option<bool>,
/// Upscaling factor. More coming soon.
/// 4
#[serde(skip_serializing_if = "Option::is_none")]
pub upscaling_factor: Option<i64>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct Output {
/// Upscaled image
pub image: Image,
/// Timings for each step in the pipeline.
pub timings: Timings,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ValidationError {
pub loc: Vec<serde_json::Value>,
pub msg: String,
#[serde(rename = "type")]
pub ty: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Timings {
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(rename = "type")]
pub ty: Option<serde_json::Value>,
}
/// AuraSR
///
/// Category: image-to-image
/// Machine Type: A100
pub fn aura_sr(params: Input) -> FalRequest<Input, Output> {
FalRequest::new("fal-ai/aura-sr", params)
}
@@ -0,0 +1,76 @@
#[allow(unused_imports)]
use crate::prelude::*;
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::collections::HashMap;
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct CaptionInput {
/// Size of text in generated captions.
#[serde(skip_serializing_if = "Option::is_none")]
pub font_size: Option<i64>,
/// Left-to-right alignment of the text. Can be a string ('left', 'center', 'right') or a float (0.0-1.0)
#[serde(skip_serializing_if = "Option::is_none")]
pub left_align: Option<LeftAlignProperty>,
/// Number of seconds the captions should stay on screen. A higher number will also result in more text being displayed at once.
#[serde(skip_serializing_if = "Option::is_none")]
pub refresh_interval: Option<f64>,
/// Width of the text strokes in pixels
#[serde(skip_serializing_if = "Option::is_none")]
pub stroke_width: Option<i64>,
/// Top-to-bottom alignment of the text. Can be a string ('top', 'center', 'bottom') or a float (0.0-1.0)
#[serde(skip_serializing_if = "Option::is_none")]
pub top_align: Option<TopAlignProperty>,
/// Colour of the text. Can be a RGB tuple, a color name, or an hexadecimal notation.
#[serde(skip_serializing_if = "Option::is_none")]
pub txt_color: Option<String>,
/// Font for generated captions. Choose one in 'Arial','Standard','Garamond', 'Times New Roman','Georgia', or pass a url to a .ttf file
#[serde(skip_serializing_if = "Option::is_none")]
pub txt_font: Option<String>,
/// URL to the .mp4 video with audio. Only videos of size <100MB are allowed.
pub video_url: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct HTTPValidationError {
#[serde(skip_serializing_if = "Option::is_none")]
pub detail: Option<Vec<Option<ValidationError>>>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct Output {
/// URL to the caption .mp4 video.
pub video_url: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ValidationError {
pub loc: Vec<serde_json::Value>,
pub msg: String,
#[serde(rename = "type")]
pub ty: String,
}
#[derive(Debug, Serialize, Deserialize, smart_default::SmartDefault)]
#[allow(non_camel_case_types)]
pub enum LeftAlignProperty {
#[default]
String(String),
Number(f64),
}
#[derive(Debug, Serialize, Deserialize, smart_default::SmartDefault)]
#[allow(non_camel_case_types)]
pub enum TopAlignProperty {
#[default]
String(String),
Number(f64),
}
/// Auto-Captioner
///
/// Category: video-to-video
pub fn auto_caption(params: CaptionInput) -> FalRequest<CaptionInput, Output> {
FalRequest::new("fal-ai/auto-caption", params)
}
+14
View File
@@ -0,0 +1,14 @@
#[cfg(any(
feature = "endpoints",
feature = "endpoints_fal-ai",
feature = "endpoints_fal-ai_ben"
))]
#[cfg_attr(
docsrs,
doc(cfg(any(
feature = "endpoints",
feature = "endpoints_fal-ai",
feature = "endpoints_fal-ai_ben"
)))
)]
pub mod v2;
@@ -0,0 +1,118 @@
#[allow(unused_imports)]
use crate::prelude::*;
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::collections::HashMap;
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Ben2InputImage {
/// URL of image to be used for background removal
/// "https://storage.googleapis.com/falserverless/gallery/Ben2/arduino-uno-board-electronics-hand-600nw-1869855883.webp"
pub image_url: String,
/// Random seed for reproducible generation.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Ben2InputVideo {
/// Random seed for reproducible generation.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// URL of video to be used for background removal.
/// "https://storage.googleapis.com/falserverless/gallery/Ben2/100063-video-2160.mp4"
pub video_url: String,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct Ben2OutputImage {
/// The output image after background removal.
/// {"content_type":"image/png","file_name":"zrZNETpI_ul2jonraqpxN_a57c3f3825d9418f8b3d39cde87c3310.png","file_size":423052,"height":512,"url":"https://storage.googleapis.com/falserverless/gallery/Ben2/zrZNETpI_ul2jonraqpxN_a57c3f3825d9418f8b3d39cde87c3310.png","width":512}
pub image: Image,
/// Seed of the generated Image. It will be the same value of the one passed in the
/// input or the randomly generated that was used in case none was passed.
pub seed: i64,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Ben2OutputVideo {
/// Seed of the generated Image. It will be the same value of the one passed in the
/// input or the randomly generated that was used in case none was passed.
pub seed: i64,
/// The generated video file.
/// {"content_type":"video/mp4","url":"https://storage.googleapis.com/falserverless/gallery/Ben2/foreground.mp4"}
pub video: File,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct File {
/// The mime type of the file.
/// "image/png"
#[serde(skip_serializing_if = "Option::is_none")]
pub content_type: Option<String>,
/// File data
#[serde(skip_serializing_if = "Option::is_none")]
pub file_data: Option<String>,
/// The name of the file. It will be auto-generated if not provided.
/// "z9RV14K95DvU.png"
#[serde(skip_serializing_if = "Option::is_none")]
pub file_name: Option<String>,
/// The size of the file in bytes.
/// 4404019
#[serde(skip_serializing_if = "Option::is_none")]
pub file_size: Option<i64>,
/// The URL where the file can be downloaded from.
pub url: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct HTTPValidationError {
#[serde(skip_serializing_if = "Option::is_none")]
pub detail: Option<Vec<Option<ValidationError>>>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Image {
/// The mime type of the file.
/// "image/png"
#[serde(skip_serializing_if = "Option::is_none")]
pub content_type: Option<String>,
/// File data
#[serde(skip_serializing_if = "Option::is_none")]
pub file_data: Option<String>,
/// The name of the file. It will be auto-generated if not provided.
/// "z9RV14K95DvU.png"
#[serde(skip_serializing_if = "Option::is_none")]
pub file_name: Option<String>,
/// The size of the file in bytes.
/// 4404019
#[serde(skip_serializing_if = "Option::is_none")]
pub file_size: Option<i64>,
/// The height of the image in pixels.
/// 1024
#[serde(skip_serializing_if = "Option::is_none")]
pub height: Option<i64>,
/// The URL where the file can be downloaded from.
pub url: String,
/// The width of the image in pixels.
/// 1024
#[serde(skip_serializing_if = "Option::is_none")]
pub width: Option<i64>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ValidationError {
pub loc: Vec<serde_json::Value>,
pub msg: String,
#[serde(rename = "type")]
pub ty: String,
}
/// ben-v2-image
///
/// Category: image-to-image
/// Machine Type: A100
pub fn image(params: Ben2InputImage) -> FalRequest<Ben2InputImage, Ben2OutputImage> {
FalRequest::new("fal-ai/ben/v2/image", params)
}
+28
View File
@@ -0,0 +1,28 @@
#[cfg(any(
feature = "endpoints",
feature = "endpoints_fal-ai",
feature = "endpoints_fal-ai_ben"
))]
#[cfg_attr(
docsrs,
doc(cfg(any(
feature = "endpoints",
feature = "endpoints_fal-ai",
feature = "endpoints_fal-ai_ben"
)))
)]
pub mod image;
#[cfg(any(
feature = "endpoints",
feature = "endpoints_fal-ai",
feature = "endpoints_fal-ai_ben"
))]
#[cfg_attr(
docsrs,
doc(cfg(any(
feature = "endpoints",
feature = "endpoints_fal-ai",
feature = "endpoints_fal-ai_ben"
)))
)]
pub mod video;
@@ -0,0 +1,118 @@
#[allow(unused_imports)]
use crate::prelude::*;
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::collections::HashMap;
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Ben2InputImage {
/// URL of image to be used for background removal
/// "https://storage.googleapis.com/falserverless/gallery/Ben2/arduino-uno-board-electronics-hand-600nw-1869855883.webp"
pub image_url: String,
/// Random seed for reproducible generation.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Ben2InputVideo {
/// Random seed for reproducible generation.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// URL of video to be used for background removal.
/// "https://storage.googleapis.com/falserverless/gallery/Ben2/100063-video-2160.mp4"
pub video_url: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Ben2OutputImage {
/// The output image after background removal.
/// {"content_type":"image/png","file_name":"zrZNETpI_ul2jonraqpxN_a57c3f3825d9418f8b3d39cde87c3310.png","file_size":423052,"height":512,"url":"https://storage.googleapis.com/falserverless/gallery/Ben2/zrZNETpI_ul2jonraqpxN_a57c3f3825d9418f8b3d39cde87c3310.png","width":512}
pub image: Image,
/// Seed of the generated Image. It will be the same value of the one passed in the
/// input or the randomly generated that was used in case none was passed.
pub seed: i64,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct Ben2OutputVideo {
/// Seed of the generated Image. It will be the same value of the one passed in the
/// input or the randomly generated that was used in case none was passed.
pub seed: i64,
/// The generated video file.
/// {"content_type":"video/mp4","url":"https://storage.googleapis.com/falserverless/gallery/Ben2/foreground.mp4"}
pub video: File,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct File {
/// The mime type of the file.
/// "image/png"
#[serde(skip_serializing_if = "Option::is_none")]
pub content_type: Option<String>,
/// File data
#[serde(skip_serializing_if = "Option::is_none")]
pub file_data: Option<String>,
/// The name of the file. It will be auto-generated if not provided.
/// "z9RV14K95DvU.png"
#[serde(skip_serializing_if = "Option::is_none")]
pub file_name: Option<String>,
/// The size of the file in bytes.
/// 4404019
#[serde(skip_serializing_if = "Option::is_none")]
pub file_size: Option<i64>,
/// The URL where the file can be downloaded from.
pub url: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct HTTPValidationError {
#[serde(skip_serializing_if = "Option::is_none")]
pub detail: Option<Vec<Option<ValidationError>>>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Image {
/// The mime type of the file.
/// "image/png"
#[serde(skip_serializing_if = "Option::is_none")]
pub content_type: Option<String>,
/// File data
#[serde(skip_serializing_if = "Option::is_none")]
pub file_data: Option<String>,
/// The name of the file. It will be auto-generated if not provided.
/// "z9RV14K95DvU.png"
#[serde(skip_serializing_if = "Option::is_none")]
pub file_name: Option<String>,
/// The size of the file in bytes.
/// 4404019
#[serde(skip_serializing_if = "Option::is_none")]
pub file_size: Option<i64>,
/// The height of the image in pixels.
/// 1024
#[serde(skip_serializing_if = "Option::is_none")]
pub height: Option<i64>,
/// The URL where the file can be downloaded from.
pub url: String,
/// The width of the image in pixels.
/// 1024
#[serde(skip_serializing_if = "Option::is_none")]
pub width: Option<i64>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ValidationError {
pub loc: Vec<serde_json::Value>,
pub msg: String,
#[serde(rename = "type")]
pub ty: String,
}
/// ben-v2-image
///
/// Category: image-to-image
/// Machine Type: A100
pub fn video(params: Ben2InputVideo) -> FalRequest<Ben2InputVideo, Ben2OutputVideo> {
FalRequest::new("fal-ai/ben/v2/video", params)
}
@@ -0,0 +1,145 @@
#[allow(unused_imports)]
use crate::prelude::*;
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::collections::HashMap;
#[cfg(any(
feature = "endpoints",
feature = "endpoints_fal-ai",
feature = "endpoints_fal-ai_birefnet"
))]
#[cfg_attr(
docsrs,
doc(cfg(any(
feature = "endpoints",
feature = "endpoints_fal-ai",
feature = "endpoints_fal-ai_birefnet"
)))
)]
pub mod v2;
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct HTTPValidationError {
#[serde(skip_serializing_if = "Option::is_none")]
pub detail: Option<Vec<Option<ValidationError>>>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Image {
/// The mime type of the file.
/// "image/png"
#[serde(skip_serializing_if = "Option::is_none")]
pub content_type: Option<String>,
/// File data
#[serde(skip_serializing_if = "Option::is_none")]
pub file_data: Option<String>,
/// The name of the file. It will be auto-generated if not provided.
/// "z9RV14K95DvU.png"
#[serde(skip_serializing_if = "Option::is_none")]
pub file_name: Option<String>,
/// The size of the file in bytes.
/// 4404019
#[serde(skip_serializing_if = "Option::is_none")]
pub file_size: Option<i64>,
/// The height of the image in pixels.
/// 1024
#[serde(skip_serializing_if = "Option::is_none")]
pub height: Option<i64>,
/// The URL where the file can be downloaded from.
pub url: String,
/// The width of the image in pixels.
/// 1024
#[serde(skip_serializing_if = "Option::is_none")]
pub width: Option<i64>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Input {
/// URL of the image to remove background from
/// "https://fal.media/files/panda/K5Rndvzmn1j-OI1VZXDVd.jpeg"
pub image_url: String,
/// Model to use for background removal.
/// The 'General Use (Light)' model is the original model used in the BiRefNet repository.
/// The 'General Use (Heavy)' model is a slower but more accurate model.
/// The 'Portrait' model is a model trained specifically for portrait images.
/// The 'General Use (Light)' model is recommended for most use cases.
///
/// The corresponding models are as follows:
/// - 'General Use (Light)': BiRefNet-DIS_ep580.pth
/// - 'General Use (Heavy)': BiRefNet-massive-epoch_240.pth
/// - 'Portrait': BiRefNet-portrait-TR_P3M_10k-epoch_120.pth
#[serde(skip_serializing_if = "Option::is_none")]
pub model: Option<String>,
/// The resolution to operate on. The higher the resolution, the more accurate the output will be for high res input images.
#[serde(skip_serializing_if = "Option::is_none")]
pub operating_resolution: Option<String>,
/// The format of the output image
#[serde(skip_serializing_if = "Option::is_none")]
pub output_format: Option<String>,
/// Whether to output the mask used to remove the background
#[serde(skip_serializing_if = "Option::is_none")]
pub output_mask: Option<bool>,
/// Whether to refine the foreground using the estimated mask
#[serde(skip_serializing_if = "Option::is_none")]
pub refine_foreground: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct InputV2 {
/// URL of the image to remove background from
/// "https://fal.media/files/panda/K5Rndvzmn1j-OI1VZXDVd.jpeg"
pub image_url: String,
/// Model to use for background removal.
/// The 'General Use (Light)' model is the original model used in the BiRefNet repository.
/// The 'General Use (Light)' model is the original model used in the BiRefNet repository but trained with 2K images.
/// The 'General Use (Heavy)' model is a slower but more accurate model.
/// The 'Matting' model is a model trained specifically for matting images.
/// The 'Portrait' model is a model trained specifically for portrait images.
/// The 'General Use (Light)' model is recommended for most use cases.
///
/// The corresponding models are as follows:
/// - 'General Use (Light)': BiRefNet-DIS_ep580.pth
/// - 'General Use (Heavy)': BiRefNet-massive-epoch_240.pth
/// - 'Portrait': BiRefNet-portrait-TR_P3M_10k-epoch_120.pth
#[serde(skip_serializing_if = "Option::is_none")]
pub model: Option<String>,
/// The resolution to operate on. The higher the resolution, the more accurate the output will be for high res input images.
#[serde(skip_serializing_if = "Option::is_none")]
pub operating_resolution: Option<String>,
/// The format of the output image
#[serde(skip_serializing_if = "Option::is_none")]
pub output_format: Option<String>,
/// Whether to output the mask used to remove the background
#[serde(skip_serializing_if = "Option::is_none")]
pub output_mask: Option<bool>,
/// Whether to refine the foreground using the estimated mask
#[serde(skip_serializing_if = "Option::is_none")]
pub refine_foreground: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct Output {
/// Image with background removed
pub image: Image,
/// Mask used to remove the background
#[serde(skip_serializing_if = "Option::is_none")]
pub mask_image: Option<Option<Image>>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ValidationError {
pub loc: Vec<serde_json::Value>,
pub msg: String,
#[serde(rename = "type")]
pub ty: String,
}
/// Birefnet Background Removal
///
/// Category: image-to-image
/// Machine Type: A100
pub fn birefnet(params: Input) -> FalRequest<Input, Output> {
FalRequest::new("fal-ai/birefnet", params)
}
@@ -0,0 +1,130 @@
#[allow(unused_imports)]
use crate::prelude::*;
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::collections::HashMap;
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct HTTPValidationError {
#[serde(skip_serializing_if = "Option::is_none")]
pub detail: Option<Vec<Option<ValidationError>>>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Image {
/// The mime type of the file.
/// "image/png"
#[serde(skip_serializing_if = "Option::is_none")]
pub content_type: Option<String>,
/// File data
#[serde(skip_serializing_if = "Option::is_none")]
pub file_data: Option<String>,
/// The name of the file. It will be auto-generated if not provided.
/// "z9RV14K95DvU.png"
#[serde(skip_serializing_if = "Option::is_none")]
pub file_name: Option<String>,
/// The size of the file in bytes.
/// 4404019
#[serde(skip_serializing_if = "Option::is_none")]
pub file_size: Option<i64>,
/// The height of the image in pixels.
/// 1024
#[serde(skip_serializing_if = "Option::is_none")]
pub height: Option<i64>,
/// The URL where the file can be downloaded from.
pub url: String,
/// The width of the image in pixels.
/// 1024
#[serde(skip_serializing_if = "Option::is_none")]
pub width: Option<i64>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Input {
/// URL of the image to remove background from
/// "https://fal.media/files/panda/K5Rndvzmn1j-OI1VZXDVd.jpeg"
pub image_url: String,
/// Model to use for background removal.
/// The 'General Use (Light)' model is the original model used in the BiRefNet repository.
/// The 'General Use (Heavy)' model is a slower but more accurate model.
/// The 'Portrait' model is a model trained specifically for portrait images.
/// The 'General Use (Light)' model is recommended for most use cases.
///
/// The corresponding models are as follows:
/// - 'General Use (Light)': BiRefNet-DIS_ep580.pth
/// - 'General Use (Heavy)': BiRefNet-massive-epoch_240.pth
/// - 'Portrait': BiRefNet-portrait-TR_P3M_10k-epoch_120.pth
#[serde(skip_serializing_if = "Option::is_none")]
pub model: Option<String>,
/// The resolution to operate on. The higher the resolution, the more accurate the output will be for high res input images.
#[serde(skip_serializing_if = "Option::is_none")]
pub operating_resolution: Option<String>,
/// The format of the output image
#[serde(skip_serializing_if = "Option::is_none")]
pub output_format: Option<String>,
/// Whether to output the mask used to remove the background
#[serde(skip_serializing_if = "Option::is_none")]
pub output_mask: Option<bool>,
/// Whether to refine the foreground using the estimated mask
#[serde(skip_serializing_if = "Option::is_none")]
pub refine_foreground: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct InputV2 {
/// URL of the image to remove background from
/// "https://fal.media/files/panda/K5Rndvzmn1j-OI1VZXDVd.jpeg"
pub image_url: String,
/// Model to use for background removal.
/// The 'General Use (Light)' model is the original model used in the BiRefNet repository.
/// The 'General Use (Light)' model is the original model used in the BiRefNet repository but trained with 2K images.
/// The 'General Use (Heavy)' model is a slower but more accurate model.
/// The 'Matting' model is a model trained specifically for matting images.
/// The 'Portrait' model is a model trained specifically for portrait images.
/// The 'General Use (Light)' model is recommended for most use cases.
///
/// The corresponding models are as follows:
/// - 'General Use (Light)': BiRefNet-DIS_ep580.pth
/// - 'General Use (Heavy)': BiRefNet-massive-epoch_240.pth
/// - 'Portrait': BiRefNet-portrait-TR_P3M_10k-epoch_120.pth
#[serde(skip_serializing_if = "Option::is_none")]
pub model: Option<String>,
/// The resolution to operate on. The higher the resolution, the more accurate the output will be for high res input images.
#[serde(skip_serializing_if = "Option::is_none")]
pub operating_resolution: Option<String>,
/// The format of the output image
#[serde(skip_serializing_if = "Option::is_none")]
pub output_format: Option<String>,
/// Whether to output the mask used to remove the background
#[serde(skip_serializing_if = "Option::is_none")]
pub output_mask: Option<bool>,
/// Whether to refine the foreground using the estimated mask
#[serde(skip_serializing_if = "Option::is_none")]
pub refine_foreground: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct Output {
/// Image with background removed
pub image: Image,
/// Mask used to remove the background
#[serde(skip_serializing_if = "Option::is_none")]
pub mask_image: Option<Option<Image>>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ValidationError {
pub loc: Vec<serde_json::Value>,
pub msg: String,
#[serde(rename = "type")]
pub ty: String,
}
/// Birefnet Background Removal
///
/// Category: image-to-image
/// Machine Type: A100
pub fn v2(params: InputV2) -> FalRequest<InputV2, Output> {
FalRequest::new("fal-ai/birefnet/v2", params)
}
@@ -0,0 +1,28 @@
#[cfg(any(
feature = "endpoints",
feature = "endpoints_fal-ai",
feature = "endpoints_fal-ai_bria"
))]
#[cfg_attr(
docsrs,
doc(cfg(any(
feature = "endpoints",
feature = "endpoints_fal-ai",
feature = "endpoints_fal-ai_bria"
)))
)]
pub mod remove;
#[cfg(any(
feature = "endpoints",
feature = "endpoints_fal-ai",
feature = "endpoints_fal-ai_bria"
))]
#[cfg_attr(
docsrs,
doc(cfg(any(
feature = "endpoints",
feature = "endpoints_fal-ai",
feature = "endpoints_fal-ai_bria"
)))
)]
pub mod replace;
@@ -0,0 +1,445 @@
#[allow(unused_imports)]
use crate::prelude::*;
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::collections::HashMap;
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct BGRemoveInput {
/// Input Image to erase from
/// "https://fal.media/files/panda/K5Rndvzmn1j-OI1VZXDVd.jpeg"
pub image_url: String,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct BGRemoveOutput {
/// The generated image
/// {"content_type":"image/png","file_name":"070c731993e949d993c10ef6283d335d.png","file_size":1076276,"height":1024,"url":"https://v3.fal.media/files/tiger/GQEMNjRyxSoza7N8LPPqb_070c731993e949d993c10ef6283d335d.png","width":1024}
pub image: Image,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct BGReplaceInput {
/// Whether to use the fast model
#[serde(skip_serializing_if = "Option::is_none")]
pub fast: Option<bool>,
/// Input Image to erase from
/// "https://storage.googleapis.com/falserverless/bria/bria_bg_replace_fg.jpg"
pub image_url: String,
/// The negative prompt you would like to use to generate images.
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// Number of Images to generate.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_images: Option<i64>,
/// The prompt you would like to use to generate images.
/// "Lilypad on a river"
#[serde(skip_serializing_if = "Option::is_none")]
pub prompt: Option<String>,
/// The URL of the reference image to be used for generating the new background. Use "" to leave empty. Either ref_image_url or bg_prompt has to be provided but not both. If both ref_image_url and ref_image_file are provided, ref_image_url will be used. Accepted formats are jpeg, jpg, png, webp.
/// "https://storage.googleapis.com/falserverless/bria/bria_bg_replace_bg.jpg"
#[serde(skip_serializing_if = "Option::is_none")]
pub ref_image_url: Option<String>,
/// Whether to refine prompt
#[serde(skip_serializing_if = "Option::is_none")]
pub refine_prompt: Option<bool>,
/// The same seed and the same prompt given to the same version of the model
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct BGReplaceOutput {
/// The generated images
/// [{"content_type":"image/png","url":"https://storage.googleapis.com/falserverless/bria/bria_bg_replace_res.jpg"}]
pub images: Vec<Image>,
/// Seed value used for generation.
pub seed: i64,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct EraserInput {
/// Input Image to erase from
/// "https://storage.googleapis.com/falserverless/bria/bria_eraser_img.png"
pub image_url: String,
/// You can use this parameter to specify the type of the input mask from the list. 'manual' opttion should be used in cases in which the mask had been generated by a user (e.g. with a brush tool), and 'automatic' mask type should be used when mask had been generated by an algorithm like 'SAM'.
#[serde(skip_serializing_if = "Option::is_none")]
pub mask_type: Option<String>,
/// The URL of the binary mask image that represents the area that will be cleaned.
/// "https://storage.googleapis.com/falserverless/bria/bria_eraser_mask.png"
pub mask_url: String,
/// If set to true, attempts to preserve the alpha channel of the input image.
#[serde(skip_serializing_if = "Option::is_none")]
pub preserve_alpha: Option<bool>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct EraserOutput {
/// The generated image
/// {"content_type":"image/png","url":"https://storage.googleapis.com/falserverless/bria/bria_eraser_res.png"}
pub image: Image,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct FastTextToImageRequest {
/// The aspect ratio of the image. When a guidance method is being used, the aspect ratio is defined by the guidance image and this parameter is ignored.
#[serde(skip_serializing_if = "Option::is_none")]
pub aspect_ratio: Option<String>,
/// Guidance images to use for the generation. Up to 4 guidance methods can be combined during a single inference.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance: Option<Vec<Option<GuidanceInput>>>,
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want
/// the model to stick to your prompt when looking for a related image to show you.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance_scale: Option<f64>,
/// Which medium should be included in your generated images. This parameter is optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub medium: Option<String>,
/// The negative prompt you would like to use to generate images.
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// How many images you would like to generate. When using any Guidance Method, Value is set to 1.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_images: Option<i64>,
/// The number of iterations the model goes through to refine the generated image. This parameter is optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// The prompt you would like to use to generate images.
/// "A lone figure stands on the edge of a serene cliff at sunset, gazing out over a vast, mystical valley. The figure is clad in flowing robes that ripple in the gentle breeze, silhouetted against the golden and lavender hues of the sky. Below, a cascading waterfall pours into a sparkling river winding through a forest of bioluminescent trees. The scene blends the awe of nature with a touch of otherworldly wonder, inviting reflection and imagination."
pub prompt: String,
/// When set to true, enhances the provided prompt by generating additional, more descriptive variations, resulting in more diverse and creative output images.
#[serde(skip_serializing_if = "Option::is_none")]
pub prompt_enhancement: Option<bool>,
/// The same seed and the same prompt given to the same version of the model
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct GenFillInput {
/// Input Image to erase from
/// "https://storage.googleapis.com/falserverless/bria/bria_genfill_img.png"
pub image_url: String,
/// The URL of the binary mask image that represents the area that will be cleaned.
/// "https://storage.googleapis.com/falserverless/bria/bria_genfill_mask.png"
pub mask_url: String,
/// The negative prompt you would like to use to generate images.
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// Number of Images to generate.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_images: Option<i64>,
/// The prompt you would like to use to generate images.
/// "A red delicious cherry"
pub prompt: String,
/// The same seed and the same prompt given to the same version of the model
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct GenFillOutput {
/// Generated Images
/// [{"content_type":"image/png","file_name":"a0d138e6820c4ad58f1fd3c758f16047.png","file_size":1064550,"height":768,"url":"https://storage.googleapis.com/falserverless/bria/bria_genfill_res.png","width":1024}]
pub images: Vec<Image>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct GuidanceInput {
/// The image that should be used as guidance, in base64 format, with the method defined in guidance_method_1. Accepted formats are jpeg, jpg, png, webp. Maximum file size 12MB. If more then one guidance method is used, all guidance images must be of the same aspect ratio, and this will be the aspect ratio of the generated results. If guidance_method_1 is selected, an image must be provided.
pub image_url: String,
/// Which guidance type you would like to include in the generation. Up to 4 guidance methods can be combined during a single inference. This parameter is optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub method: Option<String>,
/// Impact of the guidance.
#[serde(skip_serializing_if = "Option::is_none")]
pub scale: Option<f64>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct HTTPValidationError {
#[serde(skip_serializing_if = "Option::is_none")]
pub detail: Option<Vec<Option<ValidationError>>>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Image {
/// The mime type of the file.
/// "image/png"
#[serde(skip_serializing_if = "Option::is_none")]
pub content_type: Option<String>,
/// File data
#[serde(skip_serializing_if = "Option::is_none")]
pub file_data: Option<String>,
/// The name of the file. It will be auto-generated if not provided.
/// "z9RV14K95DvU.png"
#[serde(skip_serializing_if = "Option::is_none")]
pub file_name: Option<String>,
/// The size of the file in bytes.
/// 4404019
#[serde(skip_serializing_if = "Option::is_none")]
pub file_size: Option<i64>,
/// The height of the image in pixels.
/// 1024
#[serde(skip_serializing_if = "Option::is_none")]
pub height: Option<i64>,
/// The URL where the file can be downloaded from.
pub url: String,
/// The width of the image in pixels.
/// 1024
#[serde(skip_serializing_if = "Option::is_none")]
pub width: Option<i64>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ImageExpansionInput {
/// The desired size of the final image, after the expansion. should have an area of less than 5000x5000 pixels.
/// [1200,674]
pub canvas_size: Vec<i64>,
/// The URL of the input image.
/// "https://storage.googleapis.com/falserverless/model_tests/orange.png"
pub image_url: String,
/// The negative prompt you would like to use to generate images.
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// Number of Images to generate.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_images: Option<i64>,
/// The desired location of the original image, inside the full canvas. Provide the location of the upper left corner of the original image. The location can also be outside the canvas (the original image will be cropped).
/// [301,-66]
pub original_image_location: Vec<i64>,
/// The desired size of the original image, inside the full canvas. Ensure that the ratio of input image foreground or main subject to the canvas area is greater than 15% to achieve optimal results.
/// [610,855]
pub original_image_size: Vec<i64>,
/// Text on which you wish to base the image expansion. This parameter is optional. Bria currently supports prompts in English only, excluding special characters.
#[serde(skip_serializing_if = "Option::is_none")]
pub prompt: Option<String>,
/// You can choose whether you want your generated expension to be random or predictable. You can recreate the same result in the future by using the seed value of a result from the response. You can exclude this parameter if you are not interested in recreating your results. This parameter is optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ImageExpansionOutput {
/// The generated image
/// {"content_type":"image/png","file_name":"afa402a35ea742cdb5c3e219b2b19bfb.png","file_size":1471342,"height":674,"url":"https://v3.fal.media/files/koala/8np-spgxxG-I1r3cjthRV_afa402a35ea742cdb5c3e219b2b19bfb.png","width":1200}
pub image: Image,
/// Seed value used for generation.
pub seed: i64,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Output {
/// The generated images
/// [{"content_type":"image/png","file_name":"257cf8e7bd3a47c2959396343d5b38cf.png","file_size":3731290,"height":1536,"url":"https://v3.fal.media/files/tiger/48e63e0K6C9XQYBuomoU-_257cf8e7bd3a47c2959396343d5b38cf.png","width":1536}]
pub images: Vec<Image>,
/// Seed value used for generation.
pub seed: i64,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ProductShotInput {
/// Whether to use the fast model
#[serde(skip_serializing_if = "Option::is_none")]
pub fast: Option<bool>,
/// The URL of the product shot to be placed in a lifestyle shot. If both image_url and image_file are provided, image_url will be used. Accepted formats are jpeg, jpg, png, webp. Maximum file size 12MB.
/// "https://storage.googleapis.com/falserverless/bria/bria_product_fg.jpg"
pub image_url: String,
/// If you've selected placement_type=manual_placement, you should use this parameter to specify which placements/positions you would like to use from the list. You can select more than one placement in one request.
#[serde(skip_serializing_if = "Option::is_none")]
pub manual_placement_selection: Option<String>,
/// The number of lifestyle product shots you would like to generate. You will get num_results x 10 results when placement_type=automatic and according to the number of required placements x num_results if placement_type=manual_placement.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_results: Option<i64>,
/// Whether to optimize the scene description
#[serde(skip_serializing_if = "Option::is_none")]
pub optimize_description: Option<bool>,
/// This flag is only relevant when placement_type=original. If true, the output image retains the original input image's size; otherwise, the image is scaled to 1 megapixel (1MP) while preserving its aspect ratio.
#[serde(skip_serializing_if = "Option::is_none")]
pub original_quality: Option<bool>,
/// The desired padding in pixels around the product, when using placement_type=manual_padding. The order of the values is [left, right, top, bottom]. For optimal results, the total number of pixels, including padding, should be around 1,000,000. It is recommended to first use the product cutout API, get the cutout and understand the size of the result, and then define the required padding and use the cutout as an input for this API.
#[serde(skip_serializing_if = "Option::is_none")]
pub padding_values: Option<Vec<Option<i64>>>,
/// This parameter allows you to control the positioning of the product in the image. Choosing 'original' will preserve the original position of the product in the image. Choosing 'automatic' will generate results with the 10 recommended positions for the product. Choosing 'manual_placement' will allow you to select predefined positions (using the parameter 'manual_placement_selection'). Selecting 'manual_padding' will allow you to control the position and size of the image by defining the desired padding in pixels around the product.
#[serde(skip_serializing_if = "Option::is_none")]
pub placement_type: Option<String>,
/// The URL of the reference image to be used for generating the new scene or background for the product shot. Use "" to leave empty.Either ref_image_url or scene_description has to be provided but not both. If both ref_image_url and ref_image_file are provided, ref_image_url will be used. Accepted formats are jpeg, jpg, png, webp.
/// "https://storage.googleapis.com/falserverless/bria/bria_product_bg.jpg"
#[serde(skip_serializing_if = "Option::is_none")]
pub ref_image_url: Option<String>,
/// Text description of the new scene or background for the provided product shot. Bria currently supports prompts in English only, excluding special characters.
/// "on a rock, next to the ocean, dark theme"
#[serde(skip_serializing_if = "Option::is_none")]
pub scene_description: Option<String>,
/// The desired size of the final product shot. For optimal results, the total number of pixels should be around 1,000,000. This parameter is only relevant when placement_type=automatic or placement_type=manual_placement.
#[serde(skip_serializing_if = "Option::is_none")]
pub shot_size: Option<Vec<Option<i64>>>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ProductShotOutput {
/// The generated images
/// [{"content_type":"image/png","url":"https://storage.googleapis.com/falserverless/bria/bria_product_res.png"}]
pub images: Vec<Image>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ReimagineInput {
/// Whether to use the fast model
#[serde(skip_serializing_if = "Option::is_none")]
pub fast: Option<bool>,
/// The number of iterations the model goes through to refine the generated image. This parameter is optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// How many images you would like to generate. When using any Guidance Method, Value is set to 1.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_results: Option<i64>,
/// The prompt you would like to use to generate images.
/// "A 2d illustration of a dog in a vibrant park"
pub prompt: String,
/// The same seed and the same prompt given to the same version of the model
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// The URL of the structure reference image. Use "" to leave empty. Accepted formats are jpeg, jpg, png, webp.
/// "https://storage.googleapis.com/falserverless/bria/bria_reimagine_input.png"
#[serde(skip_serializing_if = "Option::is_none")]
pub structure_image_url: Option<String>,
/// The influence of the structure reference on the generated image.
/// 0.15
#[serde(skip_serializing_if = "Option::is_none")]
pub structure_ref_influence: Option<f64>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ReimagineOutput {
/// The generated images
/// [{"content_type":"image/png","url":"https://storage.googleapis.com/falserverless/bria/bria_reimagine_output.png"}]
pub images: Vec<Image>,
/// Seed value used for generation.
pub seed: i64,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct TextToImageRequest {
/// The aspect ratio of the image. When a guidance method is being used, the aspect ratio is defined by the guidance image and this parameter is ignored.
#[serde(skip_serializing_if = "Option::is_none")]
pub aspect_ratio: Option<String>,
/// Guidance images to use for the generation. Up to 4 guidance methods can be combined during a single inference.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance: Option<Vec<Option<GuidanceInput>>>,
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want
/// the model to stick to your prompt when looking for a related image to show you.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance_scale: Option<f64>,
/// Which medium should be included in your generated images. This parameter is optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub medium: Option<String>,
/// The negative prompt you would like to use to generate images.
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// How many images you would like to generate. When using any Guidance Method, Value is set to 1.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_images: Option<i64>,
/// The number of iterations the model goes through to refine the generated image. This parameter is optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// The prompt you would like to use to generate images.
/// "A lone figure stands on the edge of a serene cliff at sunset, gazing out over a vast, mystical valley. The figure is clad in flowing robes that ripple in the gentle breeze, silhouetted against the golden and lavender hues of the sky. Below, a cascading waterfall pours into a sparkling river winding through a forest of bioluminescent trees. The scene blends the awe of nature with a touch of otherworldly wonder, inviting reflection and imagination."
pub prompt: String,
/// When set to true, enhances the provided prompt by generating additional, more descriptive variations, resulting in more diverse and creative output images.
#[serde(skip_serializing_if = "Option::is_none")]
pub prompt_enhancement: Option<bool>,
/// The same seed and the same prompt given to the same version of the model
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct UpscaleInput {
/// The desired increase in resolution.
#[serde(skip_serializing_if = "Option::is_none")]
pub desired_increase: Option<String>,
/// Input Image to erase from
/// "https://storage.googleapis.com/falserverless/model_tests/remove_background/elephant.jpg"
pub image_url: String,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct UpscaleOutput {
/// Result Image
/// {"content_type":"image/png","file_name":"db12c5f7076844d0bb84df92ab340acd.png","file_size":2494064,"height":1400,"url":"https://v3.fal.media/files/penguin/oHW1CIjw26zf3Jt-YLBTW_db12c5f7076844d0bb84df92ab340acd.png","width":1220}
pub image: Image,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ValidationError {
pub loc: Vec<serde_json::Value>,
pub msg: String,
#[serde(rename = "type")]
pub ty: String,
}
/// Bria Text-to-Image Base
///
/// Category: text-to-image
/// Machine Type: H100
/// License Type: commercial
pub fn remove(params: BGRemoveInput) -> FalRequest<BGRemoveInput, BGRemoveOutput> {
FalRequest::new("fal-ai/bria/background/remove", params)
}
@@ -0,0 +1,445 @@
#[allow(unused_imports)]
use crate::prelude::*;
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::collections::HashMap;
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct BGRemoveInput {
/// Input Image to erase from
/// "https://fal.media/files/panda/K5Rndvzmn1j-OI1VZXDVd.jpeg"
pub image_url: String,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct BGRemoveOutput {
/// The generated image
/// {"content_type":"image/png","file_name":"070c731993e949d993c10ef6283d335d.png","file_size":1076276,"height":1024,"url":"https://v3.fal.media/files/tiger/GQEMNjRyxSoza7N8LPPqb_070c731993e949d993c10ef6283d335d.png","width":1024}
pub image: Image,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct BGReplaceInput {
/// Whether to use the fast model
#[serde(skip_serializing_if = "Option::is_none")]
pub fast: Option<bool>,
/// Input Image to erase from
/// "https://storage.googleapis.com/falserverless/bria/bria_bg_replace_fg.jpg"
pub image_url: String,
/// The negative prompt you would like to use to generate images.
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// Number of Images to generate.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_images: Option<i64>,
/// The prompt you would like to use to generate images.
/// "Lilypad on a river"
#[serde(skip_serializing_if = "Option::is_none")]
pub prompt: Option<String>,
/// The URL of the reference image to be used for generating the new background. Use "" to leave empty. Either ref_image_url or bg_prompt has to be provided but not both. If both ref_image_url and ref_image_file are provided, ref_image_url will be used. Accepted formats are jpeg, jpg, png, webp.
/// "https://storage.googleapis.com/falserverless/bria/bria_bg_replace_bg.jpg"
#[serde(skip_serializing_if = "Option::is_none")]
pub ref_image_url: Option<String>,
/// Whether to refine prompt
#[serde(skip_serializing_if = "Option::is_none")]
pub refine_prompt: Option<bool>,
/// The same seed and the same prompt given to the same version of the model
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct BGReplaceOutput {
/// The generated images
/// [{"content_type":"image/png","url":"https://storage.googleapis.com/falserverless/bria/bria_bg_replace_res.jpg"}]
pub images: Vec<Image>,
/// Seed value used for generation.
pub seed: i64,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct EraserInput {
/// Input Image to erase from
/// "https://storage.googleapis.com/falserverless/bria/bria_eraser_img.png"
pub image_url: String,
/// You can use this parameter to specify the type of the input mask from the list. 'manual' opttion should be used in cases in which the mask had been generated by a user (e.g. with a brush tool), and 'automatic' mask type should be used when mask had been generated by an algorithm like 'SAM'.
#[serde(skip_serializing_if = "Option::is_none")]
pub mask_type: Option<String>,
/// The URL of the binary mask image that represents the area that will be cleaned.
/// "https://storage.googleapis.com/falserverless/bria/bria_eraser_mask.png"
pub mask_url: String,
/// If set to true, attempts to preserve the alpha channel of the input image.
#[serde(skip_serializing_if = "Option::is_none")]
pub preserve_alpha: Option<bool>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct EraserOutput {
/// The generated image
/// {"content_type":"image/png","url":"https://storage.googleapis.com/falserverless/bria/bria_eraser_res.png"}
pub image: Image,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct FastTextToImageRequest {
/// The aspect ratio of the image. When a guidance method is being used, the aspect ratio is defined by the guidance image and this parameter is ignored.
#[serde(skip_serializing_if = "Option::is_none")]
pub aspect_ratio: Option<String>,
/// Guidance images to use for the generation. Up to 4 guidance methods can be combined during a single inference.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance: Option<Vec<Option<GuidanceInput>>>,
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want
/// the model to stick to your prompt when looking for a related image to show you.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance_scale: Option<f64>,
/// Which medium should be included in your generated images. This parameter is optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub medium: Option<String>,
/// The negative prompt you would like to use to generate images.
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// How many images you would like to generate. When using any Guidance Method, Value is set to 1.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_images: Option<i64>,
/// The number of iterations the model goes through to refine the generated image. This parameter is optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// The prompt you would like to use to generate images.
/// "A lone figure stands on the edge of a serene cliff at sunset, gazing out over a vast, mystical valley. The figure is clad in flowing robes that ripple in the gentle breeze, silhouetted against the golden and lavender hues of the sky. Below, a cascading waterfall pours into a sparkling river winding through a forest of bioluminescent trees. The scene blends the awe of nature with a touch of otherworldly wonder, inviting reflection and imagination."
pub prompt: String,
/// When set to true, enhances the provided prompt by generating additional, more descriptive variations, resulting in more diverse and creative output images.
#[serde(skip_serializing_if = "Option::is_none")]
pub prompt_enhancement: Option<bool>,
/// The same seed and the same prompt given to the same version of the model
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct GenFillInput {
/// Input Image to erase from
/// "https://storage.googleapis.com/falserverless/bria/bria_genfill_img.png"
pub image_url: String,
/// The URL of the binary mask image that represents the area that will be cleaned.
/// "https://storage.googleapis.com/falserverless/bria/bria_genfill_mask.png"
pub mask_url: String,
/// The negative prompt you would like to use to generate images.
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// Number of Images to generate.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_images: Option<i64>,
/// The prompt you would like to use to generate images.
/// "A red delicious cherry"
pub prompt: String,
/// The same seed and the same prompt given to the same version of the model
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct GenFillOutput {
/// Generated Images
/// [{"content_type":"image/png","file_name":"a0d138e6820c4ad58f1fd3c758f16047.png","file_size":1064550,"height":768,"url":"https://storage.googleapis.com/falserverless/bria/bria_genfill_res.png","width":1024}]
pub images: Vec<Image>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct GuidanceInput {
/// The image that should be used as guidance, in base64 format, with the method defined in guidance_method_1. Accepted formats are jpeg, jpg, png, webp. Maximum file size 12MB. If more then one guidance method is used, all guidance images must be of the same aspect ratio, and this will be the aspect ratio of the generated results. If guidance_method_1 is selected, an image must be provided.
pub image_url: String,
/// Which guidance type you would like to include in the generation. Up to 4 guidance methods can be combined during a single inference. This parameter is optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub method: Option<String>,
/// Impact of the guidance.
#[serde(skip_serializing_if = "Option::is_none")]
pub scale: Option<f64>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct HTTPValidationError {
#[serde(skip_serializing_if = "Option::is_none")]
pub detail: Option<Vec<Option<ValidationError>>>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Image {
/// The mime type of the file.
/// "image/png"
#[serde(skip_serializing_if = "Option::is_none")]
pub content_type: Option<String>,
/// File data
#[serde(skip_serializing_if = "Option::is_none")]
pub file_data: Option<String>,
/// The name of the file. It will be auto-generated if not provided.
/// "z9RV14K95DvU.png"
#[serde(skip_serializing_if = "Option::is_none")]
pub file_name: Option<String>,
/// The size of the file in bytes.
/// 4404019
#[serde(skip_serializing_if = "Option::is_none")]
pub file_size: Option<i64>,
/// The height of the image in pixels.
/// 1024
#[serde(skip_serializing_if = "Option::is_none")]
pub height: Option<i64>,
/// The URL where the file can be downloaded from.
pub url: String,
/// The width of the image in pixels.
/// 1024
#[serde(skip_serializing_if = "Option::is_none")]
pub width: Option<i64>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ImageExpansionInput {
/// The desired size of the final image, after the expansion. should have an area of less than 5000x5000 pixels.
/// [1200,674]
pub canvas_size: Vec<i64>,
/// The URL of the input image.
/// "https://storage.googleapis.com/falserverless/model_tests/orange.png"
pub image_url: String,
/// The negative prompt you would like to use to generate images.
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// Number of Images to generate.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_images: Option<i64>,
/// The desired location of the original image, inside the full canvas. Provide the location of the upper left corner of the original image. The location can also be outside the canvas (the original image will be cropped).
/// [301,-66]
pub original_image_location: Vec<i64>,
/// The desired size of the original image, inside the full canvas. Ensure that the ratio of input image foreground or main subject to the canvas area is greater than 15% to achieve optimal results.
/// [610,855]
pub original_image_size: Vec<i64>,
/// Text on which you wish to base the image expansion. This parameter is optional. Bria currently supports prompts in English only, excluding special characters.
#[serde(skip_serializing_if = "Option::is_none")]
pub prompt: Option<String>,
/// You can choose whether you want your generated expension to be random or predictable. You can recreate the same result in the future by using the seed value of a result from the response. You can exclude this parameter if you are not interested in recreating your results. This parameter is optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ImageExpansionOutput {
/// The generated image
/// {"content_type":"image/png","file_name":"afa402a35ea742cdb5c3e219b2b19bfb.png","file_size":1471342,"height":674,"url":"https://v3.fal.media/files/koala/8np-spgxxG-I1r3cjthRV_afa402a35ea742cdb5c3e219b2b19bfb.png","width":1200}
pub image: Image,
/// Seed value used for generation.
pub seed: i64,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Output {
/// The generated images
/// [{"content_type":"image/png","file_name":"257cf8e7bd3a47c2959396343d5b38cf.png","file_size":3731290,"height":1536,"url":"https://v3.fal.media/files/tiger/48e63e0K6C9XQYBuomoU-_257cf8e7bd3a47c2959396343d5b38cf.png","width":1536}]
pub images: Vec<Image>,
/// Seed value used for generation.
pub seed: i64,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ProductShotInput {
/// Whether to use the fast model
#[serde(skip_serializing_if = "Option::is_none")]
pub fast: Option<bool>,
/// The URL of the product shot to be placed in a lifestyle shot. If both image_url and image_file are provided, image_url will be used. Accepted formats are jpeg, jpg, png, webp. Maximum file size 12MB.
/// "https://storage.googleapis.com/falserverless/bria/bria_product_fg.jpg"
pub image_url: String,
/// If you've selected placement_type=manual_placement, you should use this parameter to specify which placements/positions you would like to use from the list. You can select more than one placement in one request.
#[serde(skip_serializing_if = "Option::is_none")]
pub manual_placement_selection: Option<String>,
/// The number of lifestyle product shots you would like to generate. You will get num_results x 10 results when placement_type=automatic and according to the number of required placements x num_results if placement_type=manual_placement.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_results: Option<i64>,
/// Whether to optimize the scene description
#[serde(skip_serializing_if = "Option::is_none")]
pub optimize_description: Option<bool>,
/// This flag is only relevant when placement_type=original. If true, the output image retains the original input image's size; otherwise, the image is scaled to 1 megapixel (1MP) while preserving its aspect ratio.
#[serde(skip_serializing_if = "Option::is_none")]
pub original_quality: Option<bool>,
/// The desired padding in pixels around the product, when using placement_type=manual_padding. The order of the values is [left, right, top, bottom]. For optimal results, the total number of pixels, including padding, should be around 1,000,000. It is recommended to first use the product cutout API, get the cutout and understand the size of the result, and then define the required padding and use the cutout as an input for this API.
#[serde(skip_serializing_if = "Option::is_none")]
pub padding_values: Option<Vec<Option<i64>>>,
/// This parameter allows you to control the positioning of the product in the image. Choosing 'original' will preserve the original position of the product in the image. Choosing 'automatic' will generate results with the 10 recommended positions for the product. Choosing 'manual_placement' will allow you to select predefined positions (using the parameter 'manual_placement_selection'). Selecting 'manual_padding' will allow you to control the position and size of the image by defining the desired padding in pixels around the product.
#[serde(skip_serializing_if = "Option::is_none")]
pub placement_type: Option<String>,
/// The URL of the reference image to be used for generating the new scene or background for the product shot. Use "" to leave empty.Either ref_image_url or scene_description has to be provided but not both. If both ref_image_url and ref_image_file are provided, ref_image_url will be used. Accepted formats are jpeg, jpg, png, webp.
/// "https://storage.googleapis.com/falserverless/bria/bria_product_bg.jpg"
#[serde(skip_serializing_if = "Option::is_none")]
pub ref_image_url: Option<String>,
/// Text description of the new scene or background for the provided product shot. Bria currently supports prompts in English only, excluding special characters.
/// "on a rock, next to the ocean, dark theme"
#[serde(skip_serializing_if = "Option::is_none")]
pub scene_description: Option<String>,
/// The desired size of the final product shot. For optimal results, the total number of pixels should be around 1,000,000. This parameter is only relevant when placement_type=automatic or placement_type=manual_placement.
#[serde(skip_serializing_if = "Option::is_none")]
pub shot_size: Option<Vec<Option<i64>>>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ProductShotOutput {
/// The generated images
/// [{"content_type":"image/png","url":"https://storage.googleapis.com/falserverless/bria/bria_product_res.png"}]
pub images: Vec<Image>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ReimagineInput {
/// Whether to use the fast model
#[serde(skip_serializing_if = "Option::is_none")]
pub fast: Option<bool>,
/// The number of iterations the model goes through to refine the generated image. This parameter is optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// How many images you would like to generate. When using any Guidance Method, Value is set to 1.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_results: Option<i64>,
/// The prompt you would like to use to generate images.
/// "A 2d illustration of a dog in a vibrant park"
pub prompt: String,
/// The same seed and the same prompt given to the same version of the model
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// The URL of the structure reference image. Use "" to leave empty. Accepted formats are jpeg, jpg, png, webp.
/// "https://storage.googleapis.com/falserverless/bria/bria_reimagine_input.png"
#[serde(skip_serializing_if = "Option::is_none")]
pub structure_image_url: Option<String>,
/// The influence of the structure reference on the generated image.
/// 0.15
#[serde(skip_serializing_if = "Option::is_none")]
pub structure_ref_influence: Option<f64>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ReimagineOutput {
/// The generated images
/// [{"content_type":"image/png","url":"https://storage.googleapis.com/falserverless/bria/bria_reimagine_output.png"}]
pub images: Vec<Image>,
/// Seed value used for generation.
pub seed: i64,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct TextToImageRequest {
/// The aspect ratio of the image. When a guidance method is being used, the aspect ratio is defined by the guidance image and this parameter is ignored.
#[serde(skip_serializing_if = "Option::is_none")]
pub aspect_ratio: Option<String>,
/// Guidance images to use for the generation. Up to 4 guidance methods can be combined during a single inference.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance: Option<Vec<Option<GuidanceInput>>>,
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want
/// the model to stick to your prompt when looking for a related image to show you.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance_scale: Option<f64>,
/// Which medium should be included in your generated images. This parameter is optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub medium: Option<String>,
/// The negative prompt you would like to use to generate images.
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// How many images you would like to generate. When using any Guidance Method, Value is set to 1.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_images: Option<i64>,
/// The number of iterations the model goes through to refine the generated image. This parameter is optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// The prompt you would like to use to generate images.
/// "A lone figure stands on the edge of a serene cliff at sunset, gazing out over a vast, mystical valley. The figure is clad in flowing robes that ripple in the gentle breeze, silhouetted against the golden and lavender hues of the sky. Below, a cascading waterfall pours into a sparkling river winding through a forest of bioluminescent trees. The scene blends the awe of nature with a touch of otherworldly wonder, inviting reflection and imagination."
pub prompt: String,
/// When set to true, enhances the provided prompt by generating additional, more descriptive variations, resulting in more diverse and creative output images.
#[serde(skip_serializing_if = "Option::is_none")]
pub prompt_enhancement: Option<bool>,
/// The same seed and the same prompt given to the same version of the model
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct UpscaleInput {
/// The desired increase in resolution.
#[serde(skip_serializing_if = "Option::is_none")]
pub desired_increase: Option<String>,
/// Input Image to erase from
/// "https://storage.googleapis.com/falserverless/model_tests/remove_background/elephant.jpg"
pub image_url: String,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct UpscaleOutput {
/// Result Image
/// {"content_type":"image/png","file_name":"db12c5f7076844d0bb84df92ab340acd.png","file_size":2494064,"height":1400,"url":"https://v3.fal.media/files/penguin/oHW1CIjw26zf3Jt-YLBTW_db12c5f7076844d0bb84df92ab340acd.png","width":1220}
pub image: Image,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ValidationError {
pub loc: Vec<serde_json::Value>,
pub msg: String,
#[serde(rename = "type")]
pub ty: String,
}
/// Bria Text-to-Image Base
///
/// Category: text-to-image
/// Machine Type: H100
/// License Type: commercial
pub fn replace(params: BGReplaceInput) -> FalRequest<BGReplaceInput, BGReplaceOutput> {
FalRequest::new("fal-ai/bria/background/replace", params)
}
@@ -0,0 +1,445 @@
#[allow(unused_imports)]
use crate::prelude::*;
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::collections::HashMap;
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct BGRemoveInput {
/// Input Image to erase from
/// "https://fal.media/files/panda/K5Rndvzmn1j-OI1VZXDVd.jpeg"
pub image_url: String,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct BGRemoveOutput {
/// The generated image
/// {"content_type":"image/png","file_name":"070c731993e949d993c10ef6283d335d.png","file_size":1076276,"height":1024,"url":"https://v3.fal.media/files/tiger/GQEMNjRyxSoza7N8LPPqb_070c731993e949d993c10ef6283d335d.png","width":1024}
pub image: Image,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct BGReplaceInput {
/// Whether to use the fast model
#[serde(skip_serializing_if = "Option::is_none")]
pub fast: Option<bool>,
/// Input Image to erase from
/// "https://storage.googleapis.com/falserverless/bria/bria_bg_replace_fg.jpg"
pub image_url: String,
/// The negative prompt you would like to use to generate images.
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// Number of Images to generate.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_images: Option<i64>,
/// The prompt you would like to use to generate images.
/// "Lilypad on a river"
#[serde(skip_serializing_if = "Option::is_none")]
pub prompt: Option<String>,
/// The URL of the reference image to be used for generating the new background. Use "" to leave empty. Either ref_image_url or bg_prompt has to be provided but not both. If both ref_image_url and ref_image_file are provided, ref_image_url will be used. Accepted formats are jpeg, jpg, png, webp.
/// "https://storage.googleapis.com/falserverless/bria/bria_bg_replace_bg.jpg"
#[serde(skip_serializing_if = "Option::is_none")]
pub ref_image_url: Option<String>,
/// Whether to refine prompt
#[serde(skip_serializing_if = "Option::is_none")]
pub refine_prompt: Option<bool>,
/// The same seed and the same prompt given to the same version of the model
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct BGReplaceOutput {
/// The generated images
/// [{"content_type":"image/png","url":"https://storage.googleapis.com/falserverless/bria/bria_bg_replace_res.jpg"}]
pub images: Vec<Image>,
/// Seed value used for generation.
pub seed: i64,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct EraserInput {
/// Input Image to erase from
/// "https://storage.googleapis.com/falserverless/bria/bria_eraser_img.png"
pub image_url: String,
/// You can use this parameter to specify the type of the input mask from the list. 'manual' opttion should be used in cases in which the mask had been generated by a user (e.g. with a brush tool), and 'automatic' mask type should be used when mask had been generated by an algorithm like 'SAM'.
#[serde(skip_serializing_if = "Option::is_none")]
pub mask_type: Option<String>,
/// The URL of the binary mask image that represents the area that will be cleaned.
/// "https://storage.googleapis.com/falserverless/bria/bria_eraser_mask.png"
pub mask_url: String,
/// If set to true, attempts to preserve the alpha channel of the input image.
#[serde(skip_serializing_if = "Option::is_none")]
pub preserve_alpha: Option<bool>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct EraserOutput {
/// The generated image
/// {"content_type":"image/png","url":"https://storage.googleapis.com/falserverless/bria/bria_eraser_res.png"}
pub image: Image,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct FastTextToImageRequest {
/// The aspect ratio of the image. When a guidance method is being used, the aspect ratio is defined by the guidance image and this parameter is ignored.
#[serde(skip_serializing_if = "Option::is_none")]
pub aspect_ratio: Option<String>,
/// Guidance images to use for the generation. Up to 4 guidance methods can be combined during a single inference.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance: Option<Vec<Option<GuidanceInput>>>,
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want
/// the model to stick to your prompt when looking for a related image to show you.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance_scale: Option<f64>,
/// Which medium should be included in your generated images. This parameter is optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub medium: Option<String>,
/// The negative prompt you would like to use to generate images.
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// How many images you would like to generate. When using any Guidance Method, Value is set to 1.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_images: Option<i64>,
/// The number of iterations the model goes through to refine the generated image. This parameter is optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// The prompt you would like to use to generate images.
/// "A lone figure stands on the edge of a serene cliff at sunset, gazing out over a vast, mystical valley. The figure is clad in flowing robes that ripple in the gentle breeze, silhouetted against the golden and lavender hues of the sky. Below, a cascading waterfall pours into a sparkling river winding through a forest of bioluminescent trees. The scene blends the awe of nature with a touch of otherworldly wonder, inviting reflection and imagination."
pub prompt: String,
/// When set to true, enhances the provided prompt by generating additional, more descriptive variations, resulting in more diverse and creative output images.
#[serde(skip_serializing_if = "Option::is_none")]
pub prompt_enhancement: Option<bool>,
/// The same seed and the same prompt given to the same version of the model
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct GenFillInput {
/// Input Image to erase from
/// "https://storage.googleapis.com/falserverless/bria/bria_genfill_img.png"
pub image_url: String,
/// The URL of the binary mask image that represents the area that will be cleaned.
/// "https://storage.googleapis.com/falserverless/bria/bria_genfill_mask.png"
pub mask_url: String,
/// The negative prompt you would like to use to generate images.
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// Number of Images to generate.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_images: Option<i64>,
/// The prompt you would like to use to generate images.
/// "A red delicious cherry"
pub prompt: String,
/// The same seed and the same prompt given to the same version of the model
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct GenFillOutput {
/// Generated Images
/// [{"content_type":"image/png","file_name":"a0d138e6820c4ad58f1fd3c758f16047.png","file_size":1064550,"height":768,"url":"https://storage.googleapis.com/falserverless/bria/bria_genfill_res.png","width":1024}]
pub images: Vec<Image>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct GuidanceInput {
/// The image that should be used as guidance, in base64 format, with the method defined in guidance_method_1. Accepted formats are jpeg, jpg, png, webp. Maximum file size 12MB. If more then one guidance method is used, all guidance images must be of the same aspect ratio, and this will be the aspect ratio of the generated results. If guidance_method_1 is selected, an image must be provided.
pub image_url: String,
/// Which guidance type you would like to include in the generation. Up to 4 guidance methods can be combined during a single inference. This parameter is optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub method: Option<String>,
/// Impact of the guidance.
#[serde(skip_serializing_if = "Option::is_none")]
pub scale: Option<f64>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct HTTPValidationError {
#[serde(skip_serializing_if = "Option::is_none")]
pub detail: Option<Vec<Option<ValidationError>>>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Image {
/// The mime type of the file.
/// "image/png"
#[serde(skip_serializing_if = "Option::is_none")]
pub content_type: Option<String>,
/// File data
#[serde(skip_serializing_if = "Option::is_none")]
pub file_data: Option<String>,
/// The name of the file. It will be auto-generated if not provided.
/// "z9RV14K95DvU.png"
#[serde(skip_serializing_if = "Option::is_none")]
pub file_name: Option<String>,
/// The size of the file in bytes.
/// 4404019
#[serde(skip_serializing_if = "Option::is_none")]
pub file_size: Option<i64>,
/// The height of the image in pixels.
/// 1024
#[serde(skip_serializing_if = "Option::is_none")]
pub height: Option<i64>,
/// The URL where the file can be downloaded from.
pub url: String,
/// The width of the image in pixels.
/// 1024
#[serde(skip_serializing_if = "Option::is_none")]
pub width: Option<i64>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ImageExpansionInput {
/// The desired size of the final image, after the expansion. should have an area of less than 5000x5000 pixels.
/// [1200,674]
pub canvas_size: Vec<i64>,
/// The URL of the input image.
/// "https://storage.googleapis.com/falserverless/model_tests/orange.png"
pub image_url: String,
/// The negative prompt you would like to use to generate images.
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// Number of Images to generate.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_images: Option<i64>,
/// The desired location of the original image, inside the full canvas. Provide the location of the upper left corner of the original image. The location can also be outside the canvas (the original image will be cropped).
/// [301,-66]
pub original_image_location: Vec<i64>,
/// The desired size of the original image, inside the full canvas. Ensure that the ratio of input image foreground or main subject to the canvas area is greater than 15% to achieve optimal results.
/// [610,855]
pub original_image_size: Vec<i64>,
/// Text on which you wish to base the image expansion. This parameter is optional. Bria currently supports prompts in English only, excluding special characters.
#[serde(skip_serializing_if = "Option::is_none")]
pub prompt: Option<String>,
/// You can choose whether you want your generated expension to be random or predictable. You can recreate the same result in the future by using the seed value of a result from the response. You can exclude this parameter if you are not interested in recreating your results. This parameter is optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ImageExpansionOutput {
/// The generated image
/// {"content_type":"image/png","file_name":"afa402a35ea742cdb5c3e219b2b19bfb.png","file_size":1471342,"height":674,"url":"https://v3.fal.media/files/koala/8np-spgxxG-I1r3cjthRV_afa402a35ea742cdb5c3e219b2b19bfb.png","width":1200}
pub image: Image,
/// Seed value used for generation.
pub seed: i64,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Output {
/// The generated images
/// [{"content_type":"image/png","file_name":"257cf8e7bd3a47c2959396343d5b38cf.png","file_size":3731290,"height":1536,"url":"https://v3.fal.media/files/tiger/48e63e0K6C9XQYBuomoU-_257cf8e7bd3a47c2959396343d5b38cf.png","width":1536}]
pub images: Vec<Image>,
/// Seed value used for generation.
pub seed: i64,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ProductShotInput {
/// Whether to use the fast model
#[serde(skip_serializing_if = "Option::is_none")]
pub fast: Option<bool>,
/// The URL of the product shot to be placed in a lifestyle shot. If both image_url and image_file are provided, image_url will be used. Accepted formats are jpeg, jpg, png, webp. Maximum file size 12MB.
/// "https://storage.googleapis.com/falserverless/bria/bria_product_fg.jpg"
pub image_url: String,
/// If you've selected placement_type=manual_placement, you should use this parameter to specify which placements/positions you would like to use from the list. You can select more than one placement in one request.
#[serde(skip_serializing_if = "Option::is_none")]
pub manual_placement_selection: Option<String>,
/// The number of lifestyle product shots you would like to generate. You will get num_results x 10 results when placement_type=automatic and according to the number of required placements x num_results if placement_type=manual_placement.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_results: Option<i64>,
/// Whether to optimize the scene description
#[serde(skip_serializing_if = "Option::is_none")]
pub optimize_description: Option<bool>,
/// This flag is only relevant when placement_type=original. If true, the output image retains the original input image's size; otherwise, the image is scaled to 1 megapixel (1MP) while preserving its aspect ratio.
#[serde(skip_serializing_if = "Option::is_none")]
pub original_quality: Option<bool>,
/// The desired padding in pixels around the product, when using placement_type=manual_padding. The order of the values is [left, right, top, bottom]. For optimal results, the total number of pixels, including padding, should be around 1,000,000. It is recommended to first use the product cutout API, get the cutout and understand the size of the result, and then define the required padding and use the cutout as an input for this API.
#[serde(skip_serializing_if = "Option::is_none")]
pub padding_values: Option<Vec<Option<i64>>>,
/// This parameter allows you to control the positioning of the product in the image. Choosing 'original' will preserve the original position of the product in the image. Choosing 'automatic' will generate results with the 10 recommended positions for the product. Choosing 'manual_placement' will allow you to select predefined positions (using the parameter 'manual_placement_selection'). Selecting 'manual_padding' will allow you to control the position and size of the image by defining the desired padding in pixels around the product.
#[serde(skip_serializing_if = "Option::is_none")]
pub placement_type: Option<String>,
/// The URL of the reference image to be used for generating the new scene or background for the product shot. Use "" to leave empty.Either ref_image_url or scene_description has to be provided but not both. If both ref_image_url and ref_image_file are provided, ref_image_url will be used. Accepted formats are jpeg, jpg, png, webp.
/// "https://storage.googleapis.com/falserverless/bria/bria_product_bg.jpg"
#[serde(skip_serializing_if = "Option::is_none")]
pub ref_image_url: Option<String>,
/// Text description of the new scene or background for the provided product shot. Bria currently supports prompts in English only, excluding special characters.
/// "on a rock, next to the ocean, dark theme"
#[serde(skip_serializing_if = "Option::is_none")]
pub scene_description: Option<String>,
/// The desired size of the final product shot. For optimal results, the total number of pixels should be around 1,000,000. This parameter is only relevant when placement_type=automatic or placement_type=manual_placement.
#[serde(skip_serializing_if = "Option::is_none")]
pub shot_size: Option<Vec<Option<i64>>>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ProductShotOutput {
/// The generated images
/// [{"content_type":"image/png","url":"https://storage.googleapis.com/falserverless/bria/bria_product_res.png"}]
pub images: Vec<Image>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ReimagineInput {
/// Whether to use the fast model
#[serde(skip_serializing_if = "Option::is_none")]
pub fast: Option<bool>,
/// The number of iterations the model goes through to refine the generated image. This parameter is optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// How many images you would like to generate. When using any Guidance Method, Value is set to 1.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_results: Option<i64>,
/// The prompt you would like to use to generate images.
/// "A 2d illustration of a dog in a vibrant park"
pub prompt: String,
/// The same seed and the same prompt given to the same version of the model
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// The URL of the structure reference image. Use "" to leave empty. Accepted formats are jpeg, jpg, png, webp.
/// "https://storage.googleapis.com/falserverless/bria/bria_reimagine_input.png"
#[serde(skip_serializing_if = "Option::is_none")]
pub structure_image_url: Option<String>,
/// The influence of the structure reference on the generated image.
/// 0.15
#[serde(skip_serializing_if = "Option::is_none")]
pub structure_ref_influence: Option<f64>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ReimagineOutput {
/// The generated images
/// [{"content_type":"image/png","url":"https://storage.googleapis.com/falserverless/bria/bria_reimagine_output.png"}]
pub images: Vec<Image>,
/// Seed value used for generation.
pub seed: i64,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct TextToImageRequest {
/// The aspect ratio of the image. When a guidance method is being used, the aspect ratio is defined by the guidance image and this parameter is ignored.
#[serde(skip_serializing_if = "Option::is_none")]
pub aspect_ratio: Option<String>,
/// Guidance images to use for the generation. Up to 4 guidance methods can be combined during a single inference.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance: Option<Vec<Option<GuidanceInput>>>,
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want
/// the model to stick to your prompt when looking for a related image to show you.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance_scale: Option<f64>,
/// Which medium should be included in your generated images. This parameter is optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub medium: Option<String>,
/// The negative prompt you would like to use to generate images.
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// How many images you would like to generate. When using any Guidance Method, Value is set to 1.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_images: Option<i64>,
/// The number of iterations the model goes through to refine the generated image. This parameter is optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// The prompt you would like to use to generate images.
/// "A lone figure stands on the edge of a serene cliff at sunset, gazing out over a vast, mystical valley. The figure is clad in flowing robes that ripple in the gentle breeze, silhouetted against the golden and lavender hues of the sky. Below, a cascading waterfall pours into a sparkling river winding through a forest of bioluminescent trees. The scene blends the awe of nature with a touch of otherworldly wonder, inviting reflection and imagination."
pub prompt: String,
/// When set to true, enhances the provided prompt by generating additional, more descriptive variations, resulting in more diverse and creative output images.
#[serde(skip_serializing_if = "Option::is_none")]
pub prompt_enhancement: Option<bool>,
/// The same seed and the same prompt given to the same version of the model
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct UpscaleInput {
/// The desired increase in resolution.
#[serde(skip_serializing_if = "Option::is_none")]
pub desired_increase: Option<String>,
/// Input Image to erase from
/// "https://storage.googleapis.com/falserverless/model_tests/remove_background/elephant.jpg"
pub image_url: String,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct UpscaleOutput {
/// Result Image
/// {"content_type":"image/png","file_name":"db12c5f7076844d0bb84df92ab340acd.png","file_size":2494064,"height":1400,"url":"https://v3.fal.media/files/penguin/oHW1CIjw26zf3Jt-YLBTW_db12c5f7076844d0bb84df92ab340acd.png","width":1220}
pub image: Image,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ValidationError {
pub loc: Vec<serde_json::Value>,
pub msg: String,
#[serde(rename = "type")]
pub ty: String,
}
/// Bria Text-to-Image Base
///
/// Category: text-to-image
/// Machine Type: H100
/// License Type: commercial
pub fn eraser(params: EraserInput) -> FalRequest<EraserInput, EraserOutput> {
FalRequest::new("fal-ai/bria/eraser", params)
}
@@ -0,0 +1,447 @@
#[allow(unused_imports)]
use crate::prelude::*;
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::collections::HashMap;
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct BGRemoveInput {
/// Input Image to erase from
/// "https://fal.media/files/panda/K5Rndvzmn1j-OI1VZXDVd.jpeg"
pub image_url: String,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct BGRemoveOutput {
/// The generated image
/// {"content_type":"image/png","file_name":"070c731993e949d993c10ef6283d335d.png","file_size":1076276,"height":1024,"url":"https://v3.fal.media/files/tiger/GQEMNjRyxSoza7N8LPPqb_070c731993e949d993c10ef6283d335d.png","width":1024}
pub image: Image,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct BGReplaceInput {
/// Whether to use the fast model
#[serde(skip_serializing_if = "Option::is_none")]
pub fast: Option<bool>,
/// Input Image to erase from
/// "https://storage.googleapis.com/falserverless/bria/bria_bg_replace_fg.jpg"
pub image_url: String,
/// The negative prompt you would like to use to generate images.
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// Number of Images to generate.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_images: Option<i64>,
/// The prompt you would like to use to generate images.
/// "Lilypad on a river"
#[serde(skip_serializing_if = "Option::is_none")]
pub prompt: Option<String>,
/// The URL of the reference image to be used for generating the new background. Use "" to leave empty. Either ref_image_url or bg_prompt has to be provided but not both. If both ref_image_url and ref_image_file are provided, ref_image_url will be used. Accepted formats are jpeg, jpg, png, webp.
/// "https://storage.googleapis.com/falserverless/bria/bria_bg_replace_bg.jpg"
#[serde(skip_serializing_if = "Option::is_none")]
pub ref_image_url: Option<String>,
/// Whether to refine prompt
#[serde(skip_serializing_if = "Option::is_none")]
pub refine_prompt: Option<bool>,
/// The same seed and the same prompt given to the same version of the model
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct BGReplaceOutput {
/// The generated images
/// [{"content_type":"image/png","url":"https://storage.googleapis.com/falserverless/bria/bria_bg_replace_res.jpg"}]
pub images: Vec<Image>,
/// Seed value used for generation.
pub seed: i64,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct EraserInput {
/// Input Image to erase from
/// "https://storage.googleapis.com/falserverless/bria/bria_eraser_img.png"
pub image_url: String,
/// You can use this parameter to specify the type of the input mask from the list. 'manual' opttion should be used in cases in which the mask had been generated by a user (e.g. with a brush tool), and 'automatic' mask type should be used when mask had been generated by an algorithm like 'SAM'.
#[serde(skip_serializing_if = "Option::is_none")]
pub mask_type: Option<String>,
/// The URL of the binary mask image that represents the area that will be cleaned.
/// "https://storage.googleapis.com/falserverless/bria/bria_eraser_mask.png"
pub mask_url: String,
/// If set to true, attempts to preserve the alpha channel of the input image.
#[serde(skip_serializing_if = "Option::is_none")]
pub preserve_alpha: Option<bool>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct EraserOutput {
/// The generated image
/// {"content_type":"image/png","url":"https://storage.googleapis.com/falserverless/bria/bria_eraser_res.png"}
pub image: Image,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct FastTextToImageRequest {
/// The aspect ratio of the image. When a guidance method is being used, the aspect ratio is defined by the guidance image and this parameter is ignored.
#[serde(skip_serializing_if = "Option::is_none")]
pub aspect_ratio: Option<String>,
/// Guidance images to use for the generation. Up to 4 guidance methods can be combined during a single inference.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance: Option<Vec<Option<GuidanceInput>>>,
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want
/// the model to stick to your prompt when looking for a related image to show you.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance_scale: Option<f64>,
/// Which medium should be included in your generated images. This parameter is optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub medium: Option<String>,
/// The negative prompt you would like to use to generate images.
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// How many images you would like to generate. When using any Guidance Method, Value is set to 1.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_images: Option<i64>,
/// The number of iterations the model goes through to refine the generated image. This parameter is optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// The prompt you would like to use to generate images.
/// "A lone figure stands on the edge of a serene cliff at sunset, gazing out over a vast, mystical valley. The figure is clad in flowing robes that ripple in the gentle breeze, silhouetted against the golden and lavender hues of the sky. Below, a cascading waterfall pours into a sparkling river winding through a forest of bioluminescent trees. The scene blends the awe of nature with a touch of otherworldly wonder, inviting reflection and imagination."
pub prompt: String,
/// When set to true, enhances the provided prompt by generating additional, more descriptive variations, resulting in more diverse and creative output images.
#[serde(skip_serializing_if = "Option::is_none")]
pub prompt_enhancement: Option<bool>,
/// The same seed and the same prompt given to the same version of the model
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct GenFillInput {
/// Input Image to erase from
/// "https://storage.googleapis.com/falserverless/bria/bria_genfill_img.png"
pub image_url: String,
/// The URL of the binary mask image that represents the area that will be cleaned.
/// "https://storage.googleapis.com/falserverless/bria/bria_genfill_mask.png"
pub mask_url: String,
/// The negative prompt you would like to use to generate images.
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// Number of Images to generate.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_images: Option<i64>,
/// The prompt you would like to use to generate images.
/// "A red delicious cherry"
pub prompt: String,
/// The same seed and the same prompt given to the same version of the model
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct GenFillOutput {
/// Generated Images
/// [{"content_type":"image/png","file_name":"a0d138e6820c4ad58f1fd3c758f16047.png","file_size":1064550,"height":768,"url":"https://storage.googleapis.com/falserverless/bria/bria_genfill_res.png","width":1024}]
pub images: Vec<Image>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct GuidanceInput {
/// The image that should be used as guidance, in base64 format, with the method defined in guidance_method_1. Accepted formats are jpeg, jpg, png, webp. Maximum file size 12MB. If more then one guidance method is used, all guidance images must be of the same aspect ratio, and this will be the aspect ratio of the generated results. If guidance_method_1 is selected, an image must be provided.
pub image_url: String,
/// Which guidance type you would like to include in the generation. Up to 4 guidance methods can be combined during a single inference. This parameter is optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub method: Option<String>,
/// Impact of the guidance.
#[serde(skip_serializing_if = "Option::is_none")]
pub scale: Option<f64>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct HTTPValidationError {
#[serde(skip_serializing_if = "Option::is_none")]
pub detail: Option<Vec<Option<ValidationError>>>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Image {
/// The mime type of the file.
/// "image/png"
#[serde(skip_serializing_if = "Option::is_none")]
pub content_type: Option<String>,
/// File data
#[serde(skip_serializing_if = "Option::is_none")]
pub file_data: Option<String>,
/// The name of the file. It will be auto-generated if not provided.
/// "z9RV14K95DvU.png"
#[serde(skip_serializing_if = "Option::is_none")]
pub file_name: Option<String>,
/// The size of the file in bytes.
/// 4404019
#[serde(skip_serializing_if = "Option::is_none")]
pub file_size: Option<i64>,
/// The height of the image in pixels.
/// 1024
#[serde(skip_serializing_if = "Option::is_none")]
pub height: Option<i64>,
/// The URL where the file can be downloaded from.
pub url: String,
/// The width of the image in pixels.
/// 1024
#[serde(skip_serializing_if = "Option::is_none")]
pub width: Option<i64>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ImageExpansionInput {
/// The desired size of the final image, after the expansion. should have an area of less than 5000x5000 pixels.
/// [1200,674]
pub canvas_size: Vec<i64>,
/// The URL of the input image.
/// "https://storage.googleapis.com/falserverless/model_tests/orange.png"
pub image_url: String,
/// The negative prompt you would like to use to generate images.
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// Number of Images to generate.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_images: Option<i64>,
/// The desired location of the original image, inside the full canvas. Provide the location of the upper left corner of the original image. The location can also be outside the canvas (the original image will be cropped).
/// [301,-66]
pub original_image_location: Vec<i64>,
/// The desired size of the original image, inside the full canvas. Ensure that the ratio of input image foreground or main subject to the canvas area is greater than 15% to achieve optimal results.
/// [610,855]
pub original_image_size: Vec<i64>,
/// Text on which you wish to base the image expansion. This parameter is optional. Bria currently supports prompts in English only, excluding special characters.
#[serde(skip_serializing_if = "Option::is_none")]
pub prompt: Option<String>,
/// You can choose whether you want your generated expension to be random or predictable. You can recreate the same result in the future by using the seed value of a result from the response. You can exclude this parameter if you are not interested in recreating your results. This parameter is optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct ImageExpansionOutput {
/// The generated image
/// {"content_type":"image/png","file_name":"afa402a35ea742cdb5c3e219b2b19bfb.png","file_size":1471342,"height":674,"url":"https://v3.fal.media/files/koala/8np-spgxxG-I1r3cjthRV_afa402a35ea742cdb5c3e219b2b19bfb.png","width":1200}
pub image: Image,
/// Seed value used for generation.
pub seed: i64,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Output {
/// The generated images
/// [{"content_type":"image/png","file_name":"257cf8e7bd3a47c2959396343d5b38cf.png","file_size":3731290,"height":1536,"url":"https://v3.fal.media/files/tiger/48e63e0K6C9XQYBuomoU-_257cf8e7bd3a47c2959396343d5b38cf.png","width":1536}]
pub images: Vec<Image>,
/// Seed value used for generation.
pub seed: i64,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ProductShotInput {
/// Whether to use the fast model
#[serde(skip_serializing_if = "Option::is_none")]
pub fast: Option<bool>,
/// The URL of the product shot to be placed in a lifestyle shot. If both image_url and image_file are provided, image_url will be used. Accepted formats are jpeg, jpg, png, webp. Maximum file size 12MB.
/// "https://storage.googleapis.com/falserverless/bria/bria_product_fg.jpg"
pub image_url: String,
/// If you've selected placement_type=manual_placement, you should use this parameter to specify which placements/positions you would like to use from the list. You can select more than one placement in one request.
#[serde(skip_serializing_if = "Option::is_none")]
pub manual_placement_selection: Option<String>,
/// The number of lifestyle product shots you would like to generate. You will get num_results x 10 results when placement_type=automatic and according to the number of required placements x num_results if placement_type=manual_placement.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_results: Option<i64>,
/// Whether to optimize the scene description
#[serde(skip_serializing_if = "Option::is_none")]
pub optimize_description: Option<bool>,
/// This flag is only relevant when placement_type=original. If true, the output image retains the original input image's size; otherwise, the image is scaled to 1 megapixel (1MP) while preserving its aspect ratio.
#[serde(skip_serializing_if = "Option::is_none")]
pub original_quality: Option<bool>,
/// The desired padding in pixels around the product, when using placement_type=manual_padding. The order of the values is [left, right, top, bottom]. For optimal results, the total number of pixels, including padding, should be around 1,000,000. It is recommended to first use the product cutout API, get the cutout and understand the size of the result, and then define the required padding and use the cutout as an input for this API.
#[serde(skip_serializing_if = "Option::is_none")]
pub padding_values: Option<Vec<Option<i64>>>,
/// This parameter allows you to control the positioning of the product in the image. Choosing 'original' will preserve the original position of the product in the image. Choosing 'automatic' will generate results with the 10 recommended positions for the product. Choosing 'manual_placement' will allow you to select predefined positions (using the parameter 'manual_placement_selection'). Selecting 'manual_padding' will allow you to control the position and size of the image by defining the desired padding in pixels around the product.
#[serde(skip_serializing_if = "Option::is_none")]
pub placement_type: Option<String>,
/// The URL of the reference image to be used for generating the new scene or background for the product shot. Use "" to leave empty.Either ref_image_url or scene_description has to be provided but not both. If both ref_image_url and ref_image_file are provided, ref_image_url will be used. Accepted formats are jpeg, jpg, png, webp.
/// "https://storage.googleapis.com/falserverless/bria/bria_product_bg.jpg"
#[serde(skip_serializing_if = "Option::is_none")]
pub ref_image_url: Option<String>,
/// Text description of the new scene or background for the provided product shot. Bria currently supports prompts in English only, excluding special characters.
/// "on a rock, next to the ocean, dark theme"
#[serde(skip_serializing_if = "Option::is_none")]
pub scene_description: Option<String>,
/// The desired size of the final product shot. For optimal results, the total number of pixels should be around 1,000,000. This parameter is only relevant when placement_type=automatic or placement_type=manual_placement.
#[serde(skip_serializing_if = "Option::is_none")]
pub shot_size: Option<Vec<Option<i64>>>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ProductShotOutput {
/// The generated images
/// [{"content_type":"image/png","url":"https://storage.googleapis.com/falserverless/bria/bria_product_res.png"}]
pub images: Vec<Image>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ReimagineInput {
/// Whether to use the fast model
#[serde(skip_serializing_if = "Option::is_none")]
pub fast: Option<bool>,
/// The number of iterations the model goes through to refine the generated image. This parameter is optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// How many images you would like to generate. When using any Guidance Method, Value is set to 1.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_results: Option<i64>,
/// The prompt you would like to use to generate images.
/// "A 2d illustration of a dog in a vibrant park"
pub prompt: String,
/// The same seed and the same prompt given to the same version of the model
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// The URL of the structure reference image. Use "" to leave empty. Accepted formats are jpeg, jpg, png, webp.
/// "https://storage.googleapis.com/falserverless/bria/bria_reimagine_input.png"
#[serde(skip_serializing_if = "Option::is_none")]
pub structure_image_url: Option<String>,
/// The influence of the structure reference on the generated image.
/// 0.15
#[serde(skip_serializing_if = "Option::is_none")]
pub structure_ref_influence: Option<f64>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ReimagineOutput {
/// The generated images
/// [{"content_type":"image/png","url":"https://storage.googleapis.com/falserverless/bria/bria_reimagine_output.png"}]
pub images: Vec<Image>,
/// Seed value used for generation.
pub seed: i64,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct TextToImageRequest {
/// The aspect ratio of the image. When a guidance method is being used, the aspect ratio is defined by the guidance image and this parameter is ignored.
#[serde(skip_serializing_if = "Option::is_none")]
pub aspect_ratio: Option<String>,
/// Guidance images to use for the generation. Up to 4 guidance methods can be combined during a single inference.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance: Option<Vec<Option<GuidanceInput>>>,
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want
/// the model to stick to your prompt when looking for a related image to show you.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance_scale: Option<f64>,
/// Which medium should be included in your generated images. This parameter is optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub medium: Option<String>,
/// The negative prompt you would like to use to generate images.
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// How many images you would like to generate. When using any Guidance Method, Value is set to 1.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_images: Option<i64>,
/// The number of iterations the model goes through to refine the generated image. This parameter is optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// The prompt you would like to use to generate images.
/// "A lone figure stands on the edge of a serene cliff at sunset, gazing out over a vast, mystical valley. The figure is clad in flowing robes that ripple in the gentle breeze, silhouetted against the golden and lavender hues of the sky. Below, a cascading waterfall pours into a sparkling river winding through a forest of bioluminescent trees. The scene blends the awe of nature with a touch of otherworldly wonder, inviting reflection and imagination."
pub prompt: String,
/// When set to true, enhances the provided prompt by generating additional, more descriptive variations, resulting in more diverse and creative output images.
#[serde(skip_serializing_if = "Option::is_none")]
pub prompt_enhancement: Option<bool>,
/// The same seed and the same prompt given to the same version of the model
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct UpscaleInput {
/// The desired increase in resolution.
#[serde(skip_serializing_if = "Option::is_none")]
pub desired_increase: Option<String>,
/// Input Image to erase from
/// "https://storage.googleapis.com/falserverless/model_tests/remove_background/elephant.jpg"
pub image_url: String,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct UpscaleOutput {
/// Result Image
/// {"content_type":"image/png","file_name":"db12c5f7076844d0bb84df92ab340acd.png","file_size":2494064,"height":1400,"url":"https://v3.fal.media/files/penguin/oHW1CIjw26zf3Jt-YLBTW_db12c5f7076844d0bb84df92ab340acd.png","width":1220}
pub image: Image,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ValidationError {
pub loc: Vec<serde_json::Value>,
pub msg: String,
#[serde(rename = "type")]
pub ty: String,
}
/// Bria Text-to-Image Base
///
/// Category: text-to-image
/// Machine Type: H100
/// License Type: commercial
pub fn expand(
params: ImageExpansionInput,
) -> FalRequest<ImageExpansionInput, ImageExpansionOutput> {
FalRequest::new("fal-ai/bria/expand", params)
}
@@ -0,0 +1,445 @@
#[allow(unused_imports)]
use crate::prelude::*;
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::collections::HashMap;
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct BGRemoveInput {
/// Input Image to erase from
/// "https://fal.media/files/panda/K5Rndvzmn1j-OI1VZXDVd.jpeg"
pub image_url: String,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct BGRemoveOutput {
/// The generated image
/// {"content_type":"image/png","file_name":"070c731993e949d993c10ef6283d335d.png","file_size":1076276,"height":1024,"url":"https://v3.fal.media/files/tiger/GQEMNjRyxSoza7N8LPPqb_070c731993e949d993c10ef6283d335d.png","width":1024}
pub image: Image,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct BGReplaceInput {
/// Whether to use the fast model
#[serde(skip_serializing_if = "Option::is_none")]
pub fast: Option<bool>,
/// Input Image to erase from
/// "https://storage.googleapis.com/falserverless/bria/bria_bg_replace_fg.jpg"
pub image_url: String,
/// The negative prompt you would like to use to generate images.
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// Number of Images to generate.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_images: Option<i64>,
/// The prompt you would like to use to generate images.
/// "Lilypad on a river"
#[serde(skip_serializing_if = "Option::is_none")]
pub prompt: Option<String>,
/// The URL of the reference image to be used for generating the new background. Use "" to leave empty. Either ref_image_url or bg_prompt has to be provided but not both. If both ref_image_url and ref_image_file are provided, ref_image_url will be used. Accepted formats are jpeg, jpg, png, webp.
/// "https://storage.googleapis.com/falserverless/bria/bria_bg_replace_bg.jpg"
#[serde(skip_serializing_if = "Option::is_none")]
pub ref_image_url: Option<String>,
/// Whether to refine prompt
#[serde(skip_serializing_if = "Option::is_none")]
pub refine_prompt: Option<bool>,
/// The same seed and the same prompt given to the same version of the model
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct BGReplaceOutput {
/// The generated images
/// [{"content_type":"image/png","url":"https://storage.googleapis.com/falserverless/bria/bria_bg_replace_res.jpg"}]
pub images: Vec<Image>,
/// Seed value used for generation.
pub seed: i64,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct EraserInput {
/// Input Image to erase from
/// "https://storage.googleapis.com/falserverless/bria/bria_eraser_img.png"
pub image_url: String,
/// You can use this parameter to specify the type of the input mask from the list. 'manual' opttion should be used in cases in which the mask had been generated by a user (e.g. with a brush tool), and 'automatic' mask type should be used when mask had been generated by an algorithm like 'SAM'.
#[serde(skip_serializing_if = "Option::is_none")]
pub mask_type: Option<String>,
/// The URL of the binary mask image that represents the area that will be cleaned.
/// "https://storage.googleapis.com/falserverless/bria/bria_eraser_mask.png"
pub mask_url: String,
/// If set to true, attempts to preserve the alpha channel of the input image.
#[serde(skip_serializing_if = "Option::is_none")]
pub preserve_alpha: Option<bool>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct EraserOutput {
/// The generated image
/// {"content_type":"image/png","url":"https://storage.googleapis.com/falserverless/bria/bria_eraser_res.png"}
pub image: Image,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct FastTextToImageRequest {
/// The aspect ratio of the image. When a guidance method is being used, the aspect ratio is defined by the guidance image and this parameter is ignored.
#[serde(skip_serializing_if = "Option::is_none")]
pub aspect_ratio: Option<String>,
/// Guidance images to use for the generation. Up to 4 guidance methods can be combined during a single inference.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance: Option<Vec<Option<GuidanceInput>>>,
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want
/// the model to stick to your prompt when looking for a related image to show you.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance_scale: Option<f64>,
/// Which medium should be included in your generated images. This parameter is optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub medium: Option<String>,
/// The negative prompt you would like to use to generate images.
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// How many images you would like to generate. When using any Guidance Method, Value is set to 1.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_images: Option<i64>,
/// The number of iterations the model goes through to refine the generated image. This parameter is optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// The prompt you would like to use to generate images.
/// "A lone figure stands on the edge of a serene cliff at sunset, gazing out over a vast, mystical valley. The figure is clad in flowing robes that ripple in the gentle breeze, silhouetted against the golden and lavender hues of the sky. Below, a cascading waterfall pours into a sparkling river winding through a forest of bioluminescent trees. The scene blends the awe of nature with a touch of otherworldly wonder, inviting reflection and imagination."
pub prompt: String,
/// When set to true, enhances the provided prompt by generating additional, more descriptive variations, resulting in more diverse and creative output images.
#[serde(skip_serializing_if = "Option::is_none")]
pub prompt_enhancement: Option<bool>,
/// The same seed and the same prompt given to the same version of the model
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct GenFillInput {
/// Input Image to erase from
/// "https://storage.googleapis.com/falserverless/bria/bria_genfill_img.png"
pub image_url: String,
/// The URL of the binary mask image that represents the area that will be cleaned.
/// "https://storage.googleapis.com/falserverless/bria/bria_genfill_mask.png"
pub mask_url: String,
/// The negative prompt you would like to use to generate images.
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// Number of Images to generate.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_images: Option<i64>,
/// The prompt you would like to use to generate images.
/// "A red delicious cherry"
pub prompt: String,
/// The same seed and the same prompt given to the same version of the model
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct GenFillOutput {
/// Generated Images
/// [{"content_type":"image/png","file_name":"a0d138e6820c4ad58f1fd3c758f16047.png","file_size":1064550,"height":768,"url":"https://storage.googleapis.com/falserverless/bria/bria_genfill_res.png","width":1024}]
pub images: Vec<Image>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct GuidanceInput {
/// The image that should be used as guidance, in base64 format, with the method defined in guidance_method_1. Accepted formats are jpeg, jpg, png, webp. Maximum file size 12MB. If more then one guidance method is used, all guidance images must be of the same aspect ratio, and this will be the aspect ratio of the generated results. If guidance_method_1 is selected, an image must be provided.
pub image_url: String,
/// Which guidance type you would like to include in the generation. Up to 4 guidance methods can be combined during a single inference. This parameter is optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub method: Option<String>,
/// Impact of the guidance.
#[serde(skip_serializing_if = "Option::is_none")]
pub scale: Option<f64>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct HTTPValidationError {
#[serde(skip_serializing_if = "Option::is_none")]
pub detail: Option<Vec<Option<ValidationError>>>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Image {
/// The mime type of the file.
/// "image/png"
#[serde(skip_serializing_if = "Option::is_none")]
pub content_type: Option<String>,
/// File data
#[serde(skip_serializing_if = "Option::is_none")]
pub file_data: Option<String>,
/// The name of the file. It will be auto-generated if not provided.
/// "z9RV14K95DvU.png"
#[serde(skip_serializing_if = "Option::is_none")]
pub file_name: Option<String>,
/// The size of the file in bytes.
/// 4404019
#[serde(skip_serializing_if = "Option::is_none")]
pub file_size: Option<i64>,
/// The height of the image in pixels.
/// 1024
#[serde(skip_serializing_if = "Option::is_none")]
pub height: Option<i64>,
/// The URL where the file can be downloaded from.
pub url: String,
/// The width of the image in pixels.
/// 1024
#[serde(skip_serializing_if = "Option::is_none")]
pub width: Option<i64>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ImageExpansionInput {
/// The desired size of the final image, after the expansion. should have an area of less than 5000x5000 pixels.
/// [1200,674]
pub canvas_size: Vec<i64>,
/// The URL of the input image.
/// "https://storage.googleapis.com/falserverless/model_tests/orange.png"
pub image_url: String,
/// The negative prompt you would like to use to generate images.
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// Number of Images to generate.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_images: Option<i64>,
/// The desired location of the original image, inside the full canvas. Provide the location of the upper left corner of the original image. The location can also be outside the canvas (the original image will be cropped).
/// [301,-66]
pub original_image_location: Vec<i64>,
/// The desired size of the original image, inside the full canvas. Ensure that the ratio of input image foreground or main subject to the canvas area is greater than 15% to achieve optimal results.
/// [610,855]
pub original_image_size: Vec<i64>,
/// Text on which you wish to base the image expansion. This parameter is optional. Bria currently supports prompts in English only, excluding special characters.
#[serde(skip_serializing_if = "Option::is_none")]
pub prompt: Option<String>,
/// You can choose whether you want your generated expension to be random or predictable. You can recreate the same result in the future by using the seed value of a result from the response. You can exclude this parameter if you are not interested in recreating your results. This parameter is optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ImageExpansionOutput {
/// The generated image
/// {"content_type":"image/png","file_name":"afa402a35ea742cdb5c3e219b2b19bfb.png","file_size":1471342,"height":674,"url":"https://v3.fal.media/files/koala/8np-spgxxG-I1r3cjthRV_afa402a35ea742cdb5c3e219b2b19bfb.png","width":1200}
pub image: Image,
/// Seed value used for generation.
pub seed: i64,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Output {
/// The generated images
/// [{"content_type":"image/png","file_name":"257cf8e7bd3a47c2959396343d5b38cf.png","file_size":3731290,"height":1536,"url":"https://v3.fal.media/files/tiger/48e63e0K6C9XQYBuomoU-_257cf8e7bd3a47c2959396343d5b38cf.png","width":1536}]
pub images: Vec<Image>,
/// Seed value used for generation.
pub seed: i64,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ProductShotInput {
/// Whether to use the fast model
#[serde(skip_serializing_if = "Option::is_none")]
pub fast: Option<bool>,
/// The URL of the product shot to be placed in a lifestyle shot. If both image_url and image_file are provided, image_url will be used. Accepted formats are jpeg, jpg, png, webp. Maximum file size 12MB.
/// "https://storage.googleapis.com/falserverless/bria/bria_product_fg.jpg"
pub image_url: String,
/// If you've selected placement_type=manual_placement, you should use this parameter to specify which placements/positions you would like to use from the list. You can select more than one placement in one request.
#[serde(skip_serializing_if = "Option::is_none")]
pub manual_placement_selection: Option<String>,
/// The number of lifestyle product shots you would like to generate. You will get num_results x 10 results when placement_type=automatic and according to the number of required placements x num_results if placement_type=manual_placement.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_results: Option<i64>,
/// Whether to optimize the scene description
#[serde(skip_serializing_if = "Option::is_none")]
pub optimize_description: Option<bool>,
/// This flag is only relevant when placement_type=original. If true, the output image retains the original input image's size; otherwise, the image is scaled to 1 megapixel (1MP) while preserving its aspect ratio.
#[serde(skip_serializing_if = "Option::is_none")]
pub original_quality: Option<bool>,
/// The desired padding in pixels around the product, when using placement_type=manual_padding. The order of the values is [left, right, top, bottom]. For optimal results, the total number of pixels, including padding, should be around 1,000,000. It is recommended to first use the product cutout API, get the cutout and understand the size of the result, and then define the required padding and use the cutout as an input for this API.
#[serde(skip_serializing_if = "Option::is_none")]
pub padding_values: Option<Vec<Option<i64>>>,
/// This parameter allows you to control the positioning of the product in the image. Choosing 'original' will preserve the original position of the product in the image. Choosing 'automatic' will generate results with the 10 recommended positions for the product. Choosing 'manual_placement' will allow you to select predefined positions (using the parameter 'manual_placement_selection'). Selecting 'manual_padding' will allow you to control the position and size of the image by defining the desired padding in pixels around the product.
#[serde(skip_serializing_if = "Option::is_none")]
pub placement_type: Option<String>,
/// The URL of the reference image to be used for generating the new scene or background for the product shot. Use "" to leave empty.Either ref_image_url or scene_description has to be provided but not both. If both ref_image_url and ref_image_file are provided, ref_image_url will be used. Accepted formats are jpeg, jpg, png, webp.
/// "https://storage.googleapis.com/falserverless/bria/bria_product_bg.jpg"
#[serde(skip_serializing_if = "Option::is_none")]
pub ref_image_url: Option<String>,
/// Text description of the new scene or background for the provided product shot. Bria currently supports prompts in English only, excluding special characters.
/// "on a rock, next to the ocean, dark theme"
#[serde(skip_serializing_if = "Option::is_none")]
pub scene_description: Option<String>,
/// The desired size of the final product shot. For optimal results, the total number of pixels should be around 1,000,000. This parameter is only relevant when placement_type=automatic or placement_type=manual_placement.
#[serde(skip_serializing_if = "Option::is_none")]
pub shot_size: Option<Vec<Option<i64>>>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ProductShotOutput {
/// The generated images
/// [{"content_type":"image/png","url":"https://storage.googleapis.com/falserverless/bria/bria_product_res.png"}]
pub images: Vec<Image>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ReimagineInput {
/// Whether to use the fast model
#[serde(skip_serializing_if = "Option::is_none")]
pub fast: Option<bool>,
/// The number of iterations the model goes through to refine the generated image. This parameter is optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// How many images you would like to generate. When using any Guidance Method, Value is set to 1.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_results: Option<i64>,
/// The prompt you would like to use to generate images.
/// "A 2d illustration of a dog in a vibrant park"
pub prompt: String,
/// The same seed and the same prompt given to the same version of the model
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// The URL of the structure reference image. Use "" to leave empty. Accepted formats are jpeg, jpg, png, webp.
/// "https://storage.googleapis.com/falserverless/bria/bria_reimagine_input.png"
#[serde(skip_serializing_if = "Option::is_none")]
pub structure_image_url: Option<String>,
/// The influence of the structure reference on the generated image.
/// 0.15
#[serde(skip_serializing_if = "Option::is_none")]
pub structure_ref_influence: Option<f64>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ReimagineOutput {
/// The generated images
/// [{"content_type":"image/png","url":"https://storage.googleapis.com/falserverless/bria/bria_reimagine_output.png"}]
pub images: Vec<Image>,
/// Seed value used for generation.
pub seed: i64,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct TextToImageRequest {
/// The aspect ratio of the image. When a guidance method is being used, the aspect ratio is defined by the guidance image and this parameter is ignored.
#[serde(skip_serializing_if = "Option::is_none")]
pub aspect_ratio: Option<String>,
/// Guidance images to use for the generation. Up to 4 guidance methods can be combined during a single inference.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance: Option<Vec<Option<GuidanceInput>>>,
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want
/// the model to stick to your prompt when looking for a related image to show you.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance_scale: Option<f64>,
/// Which medium should be included in your generated images. This parameter is optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub medium: Option<String>,
/// The negative prompt you would like to use to generate images.
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// How many images you would like to generate. When using any Guidance Method, Value is set to 1.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_images: Option<i64>,
/// The number of iterations the model goes through to refine the generated image. This parameter is optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// The prompt you would like to use to generate images.
/// "A lone figure stands on the edge of a serene cliff at sunset, gazing out over a vast, mystical valley. The figure is clad in flowing robes that ripple in the gentle breeze, silhouetted against the golden and lavender hues of the sky. Below, a cascading waterfall pours into a sparkling river winding through a forest of bioluminescent trees. The scene blends the awe of nature with a touch of otherworldly wonder, inviting reflection and imagination."
pub prompt: String,
/// When set to true, enhances the provided prompt by generating additional, more descriptive variations, resulting in more diverse and creative output images.
#[serde(skip_serializing_if = "Option::is_none")]
pub prompt_enhancement: Option<bool>,
/// The same seed and the same prompt given to the same version of the model
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct UpscaleInput {
/// The desired increase in resolution.
#[serde(skip_serializing_if = "Option::is_none")]
pub desired_increase: Option<String>,
/// Input Image to erase from
/// "https://storage.googleapis.com/falserverless/model_tests/remove_background/elephant.jpg"
pub image_url: String,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct UpscaleOutput {
/// Result Image
/// {"content_type":"image/png","file_name":"db12c5f7076844d0bb84df92ab340acd.png","file_size":2494064,"height":1400,"url":"https://v3.fal.media/files/penguin/oHW1CIjw26zf3Jt-YLBTW_db12c5f7076844d0bb84df92ab340acd.png","width":1220}
pub image: Image,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ValidationError {
pub loc: Vec<serde_json::Value>,
pub msg: String,
#[serde(rename = "type")]
pub ty: String,
}
/// Bria Text-to-Image Base
///
/// Category: text-to-image
/// Machine Type: H100
/// License Type: commercial
pub fn genfill(params: GenFillInput) -> FalRequest<GenFillInput, GenFillOutput> {
FalRequest::new("fal-ai/bria/genfill", params)
}
+112
View File
@@ -0,0 +1,112 @@
#[cfg(any(
feature = "endpoints",
feature = "endpoints_fal-ai",
feature = "endpoints_fal-ai_bria"
))]
#[cfg_attr(
docsrs,
doc(cfg(any(
feature = "endpoints",
feature = "endpoints_fal-ai",
feature = "endpoints_fal-ai_bria"
)))
)]
pub mod background;
#[cfg(any(
feature = "endpoints",
feature = "endpoints_fal-ai",
feature = "endpoints_fal-ai_bria"
))]
#[cfg_attr(
docsrs,
doc(cfg(any(
feature = "endpoints",
feature = "endpoints_fal-ai",
feature = "endpoints_fal-ai_bria"
)))
)]
pub mod eraser;
#[cfg(any(
feature = "endpoints",
feature = "endpoints_fal-ai",
feature = "endpoints_fal-ai_bria"
))]
#[cfg_attr(
docsrs,
doc(cfg(any(
feature = "endpoints",
feature = "endpoints_fal-ai",
feature = "endpoints_fal-ai_bria"
)))
)]
pub mod expand;
#[cfg(any(
feature = "endpoints",
feature = "endpoints_fal-ai",
feature = "endpoints_fal-ai_bria"
))]
#[cfg_attr(
docsrs,
doc(cfg(any(
feature = "endpoints",
feature = "endpoints_fal-ai",
feature = "endpoints_fal-ai_bria"
)))
)]
pub mod genfill;
#[cfg(any(
feature = "endpoints",
feature = "endpoints_fal-ai",
feature = "endpoints_fal-ai_bria"
))]
#[cfg_attr(
docsrs,
doc(cfg(any(
feature = "endpoints",
feature = "endpoints_fal-ai",
feature = "endpoints_fal-ai_bria"
)))
)]
pub mod product_shot;
#[cfg(any(
feature = "endpoints",
feature = "endpoints_fal-ai",
feature = "endpoints_fal-ai_bria"
))]
#[cfg_attr(
docsrs,
doc(cfg(any(
feature = "endpoints",
feature = "endpoints_fal-ai",
feature = "endpoints_fal-ai_bria"
)))
)]
pub mod reimagine;
#[cfg(any(
feature = "endpoints",
feature = "endpoints_fal-ai",
feature = "endpoints_fal-ai_bria"
))]
#[cfg_attr(
docsrs,
doc(cfg(any(
feature = "endpoints",
feature = "endpoints_fal-ai",
feature = "endpoints_fal-ai_bria"
)))
)]
pub mod text_to_image;
#[cfg(any(
feature = "endpoints",
feature = "endpoints_fal-ai",
feature = "endpoints_fal-ai_bria"
))]
#[cfg_attr(
docsrs,
doc(cfg(any(
feature = "endpoints",
feature = "endpoints_fal-ai",
feature = "endpoints_fal-ai_bria"
)))
)]
pub mod upscale;
@@ -0,0 +1,445 @@
#[allow(unused_imports)]
use crate::prelude::*;
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::collections::HashMap;
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct BGRemoveInput {
/// Input Image to erase from
/// "https://fal.media/files/panda/K5Rndvzmn1j-OI1VZXDVd.jpeg"
pub image_url: String,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct BGRemoveOutput {
/// The generated image
/// {"content_type":"image/png","file_name":"070c731993e949d993c10ef6283d335d.png","file_size":1076276,"height":1024,"url":"https://v3.fal.media/files/tiger/GQEMNjRyxSoza7N8LPPqb_070c731993e949d993c10ef6283d335d.png","width":1024}
pub image: Image,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct BGReplaceInput {
/// Whether to use the fast model
#[serde(skip_serializing_if = "Option::is_none")]
pub fast: Option<bool>,
/// Input Image to erase from
/// "https://storage.googleapis.com/falserverless/bria/bria_bg_replace_fg.jpg"
pub image_url: String,
/// The negative prompt you would like to use to generate images.
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// Number of Images to generate.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_images: Option<i64>,
/// The prompt you would like to use to generate images.
/// "Lilypad on a river"
#[serde(skip_serializing_if = "Option::is_none")]
pub prompt: Option<String>,
/// The URL of the reference image to be used for generating the new background. Use "" to leave empty. Either ref_image_url or bg_prompt has to be provided but not both. If both ref_image_url and ref_image_file are provided, ref_image_url will be used. Accepted formats are jpeg, jpg, png, webp.
/// "https://storage.googleapis.com/falserverless/bria/bria_bg_replace_bg.jpg"
#[serde(skip_serializing_if = "Option::is_none")]
pub ref_image_url: Option<String>,
/// Whether to refine prompt
#[serde(skip_serializing_if = "Option::is_none")]
pub refine_prompt: Option<bool>,
/// The same seed and the same prompt given to the same version of the model
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct BGReplaceOutput {
/// The generated images
/// [{"content_type":"image/png","url":"https://storage.googleapis.com/falserverless/bria/bria_bg_replace_res.jpg"}]
pub images: Vec<Image>,
/// Seed value used for generation.
pub seed: i64,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct EraserInput {
/// Input Image to erase from
/// "https://storage.googleapis.com/falserverless/bria/bria_eraser_img.png"
pub image_url: String,
/// You can use this parameter to specify the type of the input mask from the list. 'manual' opttion should be used in cases in which the mask had been generated by a user (e.g. with a brush tool), and 'automatic' mask type should be used when mask had been generated by an algorithm like 'SAM'.
#[serde(skip_serializing_if = "Option::is_none")]
pub mask_type: Option<String>,
/// The URL of the binary mask image that represents the area that will be cleaned.
/// "https://storage.googleapis.com/falserverless/bria/bria_eraser_mask.png"
pub mask_url: String,
/// If set to true, attempts to preserve the alpha channel of the input image.
#[serde(skip_serializing_if = "Option::is_none")]
pub preserve_alpha: Option<bool>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct EraserOutput {
/// The generated image
/// {"content_type":"image/png","url":"https://storage.googleapis.com/falserverless/bria/bria_eraser_res.png"}
pub image: Image,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct FastTextToImageRequest {
/// The aspect ratio of the image. When a guidance method is being used, the aspect ratio is defined by the guidance image and this parameter is ignored.
#[serde(skip_serializing_if = "Option::is_none")]
pub aspect_ratio: Option<String>,
/// Guidance images to use for the generation. Up to 4 guidance methods can be combined during a single inference.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance: Option<Vec<Option<GuidanceInput>>>,
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want
/// the model to stick to your prompt when looking for a related image to show you.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance_scale: Option<f64>,
/// Which medium should be included in your generated images. This parameter is optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub medium: Option<String>,
/// The negative prompt you would like to use to generate images.
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// How many images you would like to generate. When using any Guidance Method, Value is set to 1.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_images: Option<i64>,
/// The number of iterations the model goes through to refine the generated image. This parameter is optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// The prompt you would like to use to generate images.
/// "A lone figure stands on the edge of a serene cliff at sunset, gazing out over a vast, mystical valley. The figure is clad in flowing robes that ripple in the gentle breeze, silhouetted against the golden and lavender hues of the sky. Below, a cascading waterfall pours into a sparkling river winding through a forest of bioluminescent trees. The scene blends the awe of nature with a touch of otherworldly wonder, inviting reflection and imagination."
pub prompt: String,
/// When set to true, enhances the provided prompt by generating additional, more descriptive variations, resulting in more diverse and creative output images.
#[serde(skip_serializing_if = "Option::is_none")]
pub prompt_enhancement: Option<bool>,
/// The same seed and the same prompt given to the same version of the model
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct GenFillInput {
/// Input Image to erase from
/// "https://storage.googleapis.com/falserverless/bria/bria_genfill_img.png"
pub image_url: String,
/// The URL of the binary mask image that represents the area that will be cleaned.
/// "https://storage.googleapis.com/falserverless/bria/bria_genfill_mask.png"
pub mask_url: String,
/// The negative prompt you would like to use to generate images.
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// Number of Images to generate.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_images: Option<i64>,
/// The prompt you would like to use to generate images.
/// "A red delicious cherry"
pub prompt: String,
/// The same seed and the same prompt given to the same version of the model
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct GenFillOutput {
/// Generated Images
/// [{"content_type":"image/png","file_name":"a0d138e6820c4ad58f1fd3c758f16047.png","file_size":1064550,"height":768,"url":"https://storage.googleapis.com/falserverless/bria/bria_genfill_res.png","width":1024}]
pub images: Vec<Image>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct GuidanceInput {
/// The image that should be used as guidance, in base64 format, with the method defined in guidance_method_1. Accepted formats are jpeg, jpg, png, webp. Maximum file size 12MB. If more then one guidance method is used, all guidance images must be of the same aspect ratio, and this will be the aspect ratio of the generated results. If guidance_method_1 is selected, an image must be provided.
pub image_url: String,
/// Which guidance type you would like to include in the generation. Up to 4 guidance methods can be combined during a single inference. This parameter is optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub method: Option<String>,
/// Impact of the guidance.
#[serde(skip_serializing_if = "Option::is_none")]
pub scale: Option<f64>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct HTTPValidationError {
#[serde(skip_serializing_if = "Option::is_none")]
pub detail: Option<Vec<Option<ValidationError>>>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Image {
/// The mime type of the file.
/// "image/png"
#[serde(skip_serializing_if = "Option::is_none")]
pub content_type: Option<String>,
/// File data
#[serde(skip_serializing_if = "Option::is_none")]
pub file_data: Option<String>,
/// The name of the file. It will be auto-generated if not provided.
/// "z9RV14K95DvU.png"
#[serde(skip_serializing_if = "Option::is_none")]
pub file_name: Option<String>,
/// The size of the file in bytes.
/// 4404019
#[serde(skip_serializing_if = "Option::is_none")]
pub file_size: Option<i64>,
/// The height of the image in pixels.
/// 1024
#[serde(skip_serializing_if = "Option::is_none")]
pub height: Option<i64>,
/// The URL where the file can be downloaded from.
pub url: String,
/// The width of the image in pixels.
/// 1024
#[serde(skip_serializing_if = "Option::is_none")]
pub width: Option<i64>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ImageExpansionInput {
/// The desired size of the final image, after the expansion. should have an area of less than 5000x5000 pixels.
/// [1200,674]
pub canvas_size: Vec<i64>,
/// The URL of the input image.
/// "https://storage.googleapis.com/falserverless/model_tests/orange.png"
pub image_url: String,
/// The negative prompt you would like to use to generate images.
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// Number of Images to generate.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_images: Option<i64>,
/// The desired location of the original image, inside the full canvas. Provide the location of the upper left corner of the original image. The location can also be outside the canvas (the original image will be cropped).
/// [301,-66]
pub original_image_location: Vec<i64>,
/// The desired size of the original image, inside the full canvas. Ensure that the ratio of input image foreground or main subject to the canvas area is greater than 15% to achieve optimal results.
/// [610,855]
pub original_image_size: Vec<i64>,
/// Text on which you wish to base the image expansion. This parameter is optional. Bria currently supports prompts in English only, excluding special characters.
#[serde(skip_serializing_if = "Option::is_none")]
pub prompt: Option<String>,
/// You can choose whether you want your generated expension to be random or predictable. You can recreate the same result in the future by using the seed value of a result from the response. You can exclude this parameter if you are not interested in recreating your results. This parameter is optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ImageExpansionOutput {
/// The generated image
/// {"content_type":"image/png","file_name":"afa402a35ea742cdb5c3e219b2b19bfb.png","file_size":1471342,"height":674,"url":"https://v3.fal.media/files/koala/8np-spgxxG-I1r3cjthRV_afa402a35ea742cdb5c3e219b2b19bfb.png","width":1200}
pub image: Image,
/// Seed value used for generation.
pub seed: i64,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Output {
/// The generated images
/// [{"content_type":"image/png","file_name":"257cf8e7bd3a47c2959396343d5b38cf.png","file_size":3731290,"height":1536,"url":"https://v3.fal.media/files/tiger/48e63e0K6C9XQYBuomoU-_257cf8e7bd3a47c2959396343d5b38cf.png","width":1536}]
pub images: Vec<Image>,
/// Seed value used for generation.
pub seed: i64,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ProductShotInput {
/// Whether to use the fast model
#[serde(skip_serializing_if = "Option::is_none")]
pub fast: Option<bool>,
/// The URL of the product shot to be placed in a lifestyle shot. If both image_url and image_file are provided, image_url will be used. Accepted formats are jpeg, jpg, png, webp. Maximum file size 12MB.
/// "https://storage.googleapis.com/falserverless/bria/bria_product_fg.jpg"
pub image_url: String,
/// If you've selected placement_type=manual_placement, you should use this parameter to specify which placements/positions you would like to use from the list. You can select more than one placement in one request.
#[serde(skip_serializing_if = "Option::is_none")]
pub manual_placement_selection: Option<String>,
/// The number of lifestyle product shots you would like to generate. You will get num_results x 10 results when placement_type=automatic and according to the number of required placements x num_results if placement_type=manual_placement.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_results: Option<i64>,
/// Whether to optimize the scene description
#[serde(skip_serializing_if = "Option::is_none")]
pub optimize_description: Option<bool>,
/// This flag is only relevant when placement_type=original. If true, the output image retains the original input image's size; otherwise, the image is scaled to 1 megapixel (1MP) while preserving its aspect ratio.
#[serde(skip_serializing_if = "Option::is_none")]
pub original_quality: Option<bool>,
/// The desired padding in pixels around the product, when using placement_type=manual_padding. The order of the values is [left, right, top, bottom]. For optimal results, the total number of pixels, including padding, should be around 1,000,000. It is recommended to first use the product cutout API, get the cutout and understand the size of the result, and then define the required padding and use the cutout as an input for this API.
#[serde(skip_serializing_if = "Option::is_none")]
pub padding_values: Option<Vec<Option<i64>>>,
/// This parameter allows you to control the positioning of the product in the image. Choosing 'original' will preserve the original position of the product in the image. Choosing 'automatic' will generate results with the 10 recommended positions for the product. Choosing 'manual_placement' will allow you to select predefined positions (using the parameter 'manual_placement_selection'). Selecting 'manual_padding' will allow you to control the position and size of the image by defining the desired padding in pixels around the product.
#[serde(skip_serializing_if = "Option::is_none")]
pub placement_type: Option<String>,
/// The URL of the reference image to be used for generating the new scene or background for the product shot. Use "" to leave empty.Either ref_image_url or scene_description has to be provided but not both. If both ref_image_url and ref_image_file are provided, ref_image_url will be used. Accepted formats are jpeg, jpg, png, webp.
/// "https://storage.googleapis.com/falserverless/bria/bria_product_bg.jpg"
#[serde(skip_serializing_if = "Option::is_none")]
pub ref_image_url: Option<String>,
/// Text description of the new scene or background for the provided product shot. Bria currently supports prompts in English only, excluding special characters.
/// "on a rock, next to the ocean, dark theme"
#[serde(skip_serializing_if = "Option::is_none")]
pub scene_description: Option<String>,
/// The desired size of the final product shot. For optimal results, the total number of pixels should be around 1,000,000. This parameter is only relevant when placement_type=automatic or placement_type=manual_placement.
#[serde(skip_serializing_if = "Option::is_none")]
pub shot_size: Option<Vec<Option<i64>>>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct ProductShotOutput {
/// The generated images
/// [{"content_type":"image/png","url":"https://storage.googleapis.com/falserverless/bria/bria_product_res.png"}]
pub images: Vec<Image>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ReimagineInput {
/// Whether to use the fast model
#[serde(skip_serializing_if = "Option::is_none")]
pub fast: Option<bool>,
/// The number of iterations the model goes through to refine the generated image. This parameter is optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// How many images you would like to generate. When using any Guidance Method, Value is set to 1.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_results: Option<i64>,
/// The prompt you would like to use to generate images.
/// "A 2d illustration of a dog in a vibrant park"
pub prompt: String,
/// The same seed and the same prompt given to the same version of the model
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// The URL of the structure reference image. Use "" to leave empty. Accepted formats are jpeg, jpg, png, webp.
/// "https://storage.googleapis.com/falserverless/bria/bria_reimagine_input.png"
#[serde(skip_serializing_if = "Option::is_none")]
pub structure_image_url: Option<String>,
/// The influence of the structure reference on the generated image.
/// 0.15
#[serde(skip_serializing_if = "Option::is_none")]
pub structure_ref_influence: Option<f64>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ReimagineOutput {
/// The generated images
/// [{"content_type":"image/png","url":"https://storage.googleapis.com/falserverless/bria/bria_reimagine_output.png"}]
pub images: Vec<Image>,
/// Seed value used for generation.
pub seed: i64,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct TextToImageRequest {
/// The aspect ratio of the image. When a guidance method is being used, the aspect ratio is defined by the guidance image and this parameter is ignored.
#[serde(skip_serializing_if = "Option::is_none")]
pub aspect_ratio: Option<String>,
/// Guidance images to use for the generation. Up to 4 guidance methods can be combined during a single inference.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance: Option<Vec<Option<GuidanceInput>>>,
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want
/// the model to stick to your prompt when looking for a related image to show you.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance_scale: Option<f64>,
/// Which medium should be included in your generated images. This parameter is optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub medium: Option<String>,
/// The negative prompt you would like to use to generate images.
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// How many images you would like to generate. When using any Guidance Method, Value is set to 1.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_images: Option<i64>,
/// The number of iterations the model goes through to refine the generated image. This parameter is optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// The prompt you would like to use to generate images.
/// "A lone figure stands on the edge of a serene cliff at sunset, gazing out over a vast, mystical valley. The figure is clad in flowing robes that ripple in the gentle breeze, silhouetted against the golden and lavender hues of the sky. Below, a cascading waterfall pours into a sparkling river winding through a forest of bioluminescent trees. The scene blends the awe of nature with a touch of otherworldly wonder, inviting reflection and imagination."
pub prompt: String,
/// When set to true, enhances the provided prompt by generating additional, more descriptive variations, resulting in more diverse and creative output images.
#[serde(skip_serializing_if = "Option::is_none")]
pub prompt_enhancement: Option<bool>,
/// The same seed and the same prompt given to the same version of the model
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct UpscaleInput {
/// The desired increase in resolution.
#[serde(skip_serializing_if = "Option::is_none")]
pub desired_increase: Option<String>,
/// Input Image to erase from
/// "https://storage.googleapis.com/falserverless/model_tests/remove_background/elephant.jpg"
pub image_url: String,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct UpscaleOutput {
/// Result Image
/// {"content_type":"image/png","file_name":"db12c5f7076844d0bb84df92ab340acd.png","file_size":2494064,"height":1400,"url":"https://v3.fal.media/files/penguin/oHW1CIjw26zf3Jt-YLBTW_db12c5f7076844d0bb84df92ab340acd.png","width":1220}
pub image: Image,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ValidationError {
pub loc: Vec<serde_json::Value>,
pub msg: String,
#[serde(rename = "type")]
pub ty: String,
}
/// Bria Text-to-Image Base
///
/// Category: text-to-image
/// Machine Type: H100
/// License Type: commercial
pub fn product_shot(params: ProductShotInput) -> FalRequest<ProductShotInput, ProductShotOutput> {
FalRequest::new("fal-ai/bria/product-shot", params)
}
@@ -0,0 +1,445 @@
#[allow(unused_imports)]
use crate::prelude::*;
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::collections::HashMap;
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct BGRemoveInput {
/// Input Image to erase from
/// "https://fal.media/files/panda/K5Rndvzmn1j-OI1VZXDVd.jpeg"
pub image_url: String,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct BGRemoveOutput {
/// The generated image
/// {"content_type":"image/png","file_name":"070c731993e949d993c10ef6283d335d.png","file_size":1076276,"height":1024,"url":"https://v3.fal.media/files/tiger/GQEMNjRyxSoza7N8LPPqb_070c731993e949d993c10ef6283d335d.png","width":1024}
pub image: Image,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct BGReplaceInput {
/// Whether to use the fast model
#[serde(skip_serializing_if = "Option::is_none")]
pub fast: Option<bool>,
/// Input Image to erase from
/// "https://storage.googleapis.com/falserverless/bria/bria_bg_replace_fg.jpg"
pub image_url: String,
/// The negative prompt you would like to use to generate images.
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// Number of Images to generate.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_images: Option<i64>,
/// The prompt you would like to use to generate images.
/// "Lilypad on a river"
#[serde(skip_serializing_if = "Option::is_none")]
pub prompt: Option<String>,
/// The URL of the reference image to be used for generating the new background. Use "" to leave empty. Either ref_image_url or bg_prompt has to be provided but not both. If both ref_image_url and ref_image_file are provided, ref_image_url will be used. Accepted formats are jpeg, jpg, png, webp.
/// "https://storage.googleapis.com/falserverless/bria/bria_bg_replace_bg.jpg"
#[serde(skip_serializing_if = "Option::is_none")]
pub ref_image_url: Option<String>,
/// Whether to refine prompt
#[serde(skip_serializing_if = "Option::is_none")]
pub refine_prompt: Option<bool>,
/// The same seed and the same prompt given to the same version of the model
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct BGReplaceOutput {
/// The generated images
/// [{"content_type":"image/png","url":"https://storage.googleapis.com/falserverless/bria/bria_bg_replace_res.jpg"}]
pub images: Vec<Image>,
/// Seed value used for generation.
pub seed: i64,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct EraserInput {
/// Input Image to erase from
/// "https://storage.googleapis.com/falserverless/bria/bria_eraser_img.png"
pub image_url: String,
/// You can use this parameter to specify the type of the input mask from the list. 'manual' opttion should be used in cases in which the mask had been generated by a user (e.g. with a brush tool), and 'automatic' mask type should be used when mask had been generated by an algorithm like 'SAM'.
#[serde(skip_serializing_if = "Option::is_none")]
pub mask_type: Option<String>,
/// The URL of the binary mask image that represents the area that will be cleaned.
/// "https://storage.googleapis.com/falserverless/bria/bria_eraser_mask.png"
pub mask_url: String,
/// If set to true, attempts to preserve the alpha channel of the input image.
#[serde(skip_serializing_if = "Option::is_none")]
pub preserve_alpha: Option<bool>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct EraserOutput {
/// The generated image
/// {"content_type":"image/png","url":"https://storage.googleapis.com/falserverless/bria/bria_eraser_res.png"}
pub image: Image,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct FastTextToImageRequest {
/// The aspect ratio of the image. When a guidance method is being used, the aspect ratio is defined by the guidance image and this parameter is ignored.
#[serde(skip_serializing_if = "Option::is_none")]
pub aspect_ratio: Option<String>,
/// Guidance images to use for the generation. Up to 4 guidance methods can be combined during a single inference.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance: Option<Vec<Option<GuidanceInput>>>,
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want
/// the model to stick to your prompt when looking for a related image to show you.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance_scale: Option<f64>,
/// Which medium should be included in your generated images. This parameter is optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub medium: Option<String>,
/// The negative prompt you would like to use to generate images.
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// How many images you would like to generate. When using any Guidance Method, Value is set to 1.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_images: Option<i64>,
/// The number of iterations the model goes through to refine the generated image. This parameter is optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// The prompt you would like to use to generate images.
/// "A lone figure stands on the edge of a serene cliff at sunset, gazing out over a vast, mystical valley. The figure is clad in flowing robes that ripple in the gentle breeze, silhouetted against the golden and lavender hues of the sky. Below, a cascading waterfall pours into a sparkling river winding through a forest of bioluminescent trees. The scene blends the awe of nature with a touch of otherworldly wonder, inviting reflection and imagination."
pub prompt: String,
/// When set to true, enhances the provided prompt by generating additional, more descriptive variations, resulting in more diverse and creative output images.
#[serde(skip_serializing_if = "Option::is_none")]
pub prompt_enhancement: Option<bool>,
/// The same seed and the same prompt given to the same version of the model
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct GenFillInput {
/// Input Image to erase from
/// "https://storage.googleapis.com/falserverless/bria/bria_genfill_img.png"
pub image_url: String,
/// The URL of the binary mask image that represents the area that will be cleaned.
/// "https://storage.googleapis.com/falserverless/bria/bria_genfill_mask.png"
pub mask_url: String,
/// The negative prompt you would like to use to generate images.
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// Number of Images to generate.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_images: Option<i64>,
/// The prompt you would like to use to generate images.
/// "A red delicious cherry"
pub prompt: String,
/// The same seed and the same prompt given to the same version of the model
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct GenFillOutput {
/// Generated Images
/// [{"content_type":"image/png","file_name":"a0d138e6820c4ad58f1fd3c758f16047.png","file_size":1064550,"height":768,"url":"https://storage.googleapis.com/falserverless/bria/bria_genfill_res.png","width":1024}]
pub images: Vec<Image>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct GuidanceInput {
/// The image that should be used as guidance, in base64 format, with the method defined in guidance_method_1. Accepted formats are jpeg, jpg, png, webp. Maximum file size 12MB. If more then one guidance method is used, all guidance images must be of the same aspect ratio, and this will be the aspect ratio of the generated results. If guidance_method_1 is selected, an image must be provided.
pub image_url: String,
/// Which guidance type you would like to include in the generation. Up to 4 guidance methods can be combined during a single inference. This parameter is optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub method: Option<String>,
/// Impact of the guidance.
#[serde(skip_serializing_if = "Option::is_none")]
pub scale: Option<f64>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct HTTPValidationError {
#[serde(skip_serializing_if = "Option::is_none")]
pub detail: Option<Vec<Option<ValidationError>>>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Image {
/// The mime type of the file.
/// "image/png"
#[serde(skip_serializing_if = "Option::is_none")]
pub content_type: Option<String>,
/// File data
#[serde(skip_serializing_if = "Option::is_none")]
pub file_data: Option<String>,
/// The name of the file. It will be auto-generated if not provided.
/// "z9RV14K95DvU.png"
#[serde(skip_serializing_if = "Option::is_none")]
pub file_name: Option<String>,
/// The size of the file in bytes.
/// 4404019
#[serde(skip_serializing_if = "Option::is_none")]
pub file_size: Option<i64>,
/// The height of the image in pixels.
/// 1024
#[serde(skip_serializing_if = "Option::is_none")]
pub height: Option<i64>,
/// The URL where the file can be downloaded from.
pub url: String,
/// The width of the image in pixels.
/// 1024
#[serde(skip_serializing_if = "Option::is_none")]
pub width: Option<i64>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ImageExpansionInput {
/// The desired size of the final image, after the expansion. should have an area of less than 5000x5000 pixels.
/// [1200,674]
pub canvas_size: Vec<i64>,
/// The URL of the input image.
/// "https://storage.googleapis.com/falserverless/model_tests/orange.png"
pub image_url: String,
/// The negative prompt you would like to use to generate images.
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// Number of Images to generate.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_images: Option<i64>,
/// The desired location of the original image, inside the full canvas. Provide the location of the upper left corner of the original image. The location can also be outside the canvas (the original image will be cropped).
/// [301,-66]
pub original_image_location: Vec<i64>,
/// The desired size of the original image, inside the full canvas. Ensure that the ratio of input image foreground or main subject to the canvas area is greater than 15% to achieve optimal results.
/// [610,855]
pub original_image_size: Vec<i64>,
/// Text on which you wish to base the image expansion. This parameter is optional. Bria currently supports prompts in English only, excluding special characters.
#[serde(skip_serializing_if = "Option::is_none")]
pub prompt: Option<String>,
/// You can choose whether you want your generated expension to be random or predictable. You can recreate the same result in the future by using the seed value of a result from the response. You can exclude this parameter if you are not interested in recreating your results. This parameter is optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ImageExpansionOutput {
/// The generated image
/// {"content_type":"image/png","file_name":"afa402a35ea742cdb5c3e219b2b19bfb.png","file_size":1471342,"height":674,"url":"https://v3.fal.media/files/koala/8np-spgxxG-I1r3cjthRV_afa402a35ea742cdb5c3e219b2b19bfb.png","width":1200}
pub image: Image,
/// Seed value used for generation.
pub seed: i64,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Output {
/// The generated images
/// [{"content_type":"image/png","file_name":"257cf8e7bd3a47c2959396343d5b38cf.png","file_size":3731290,"height":1536,"url":"https://v3.fal.media/files/tiger/48e63e0K6C9XQYBuomoU-_257cf8e7bd3a47c2959396343d5b38cf.png","width":1536}]
pub images: Vec<Image>,
/// Seed value used for generation.
pub seed: i64,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ProductShotInput {
/// Whether to use the fast model
#[serde(skip_serializing_if = "Option::is_none")]
pub fast: Option<bool>,
/// The URL of the product shot to be placed in a lifestyle shot. If both image_url and image_file are provided, image_url will be used. Accepted formats are jpeg, jpg, png, webp. Maximum file size 12MB.
/// "https://storage.googleapis.com/falserverless/bria/bria_product_fg.jpg"
pub image_url: String,
/// If you've selected placement_type=manual_placement, you should use this parameter to specify which placements/positions you would like to use from the list. You can select more than one placement in one request.
#[serde(skip_serializing_if = "Option::is_none")]
pub manual_placement_selection: Option<String>,
/// The number of lifestyle product shots you would like to generate. You will get num_results x 10 results when placement_type=automatic and according to the number of required placements x num_results if placement_type=manual_placement.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_results: Option<i64>,
/// Whether to optimize the scene description
#[serde(skip_serializing_if = "Option::is_none")]
pub optimize_description: Option<bool>,
/// This flag is only relevant when placement_type=original. If true, the output image retains the original input image's size; otherwise, the image is scaled to 1 megapixel (1MP) while preserving its aspect ratio.
#[serde(skip_serializing_if = "Option::is_none")]
pub original_quality: Option<bool>,
/// The desired padding in pixels around the product, when using placement_type=manual_padding. The order of the values is [left, right, top, bottom]. For optimal results, the total number of pixels, including padding, should be around 1,000,000. It is recommended to first use the product cutout API, get the cutout and understand the size of the result, and then define the required padding and use the cutout as an input for this API.
#[serde(skip_serializing_if = "Option::is_none")]
pub padding_values: Option<Vec<Option<i64>>>,
/// This parameter allows you to control the positioning of the product in the image. Choosing 'original' will preserve the original position of the product in the image. Choosing 'automatic' will generate results with the 10 recommended positions for the product. Choosing 'manual_placement' will allow you to select predefined positions (using the parameter 'manual_placement_selection'). Selecting 'manual_padding' will allow you to control the position and size of the image by defining the desired padding in pixels around the product.
#[serde(skip_serializing_if = "Option::is_none")]
pub placement_type: Option<String>,
/// The URL of the reference image to be used for generating the new scene or background for the product shot. Use "" to leave empty.Either ref_image_url or scene_description has to be provided but not both. If both ref_image_url and ref_image_file are provided, ref_image_url will be used. Accepted formats are jpeg, jpg, png, webp.
/// "https://storage.googleapis.com/falserverless/bria/bria_product_bg.jpg"
#[serde(skip_serializing_if = "Option::is_none")]
pub ref_image_url: Option<String>,
/// Text description of the new scene or background for the provided product shot. Bria currently supports prompts in English only, excluding special characters.
/// "on a rock, next to the ocean, dark theme"
#[serde(skip_serializing_if = "Option::is_none")]
pub scene_description: Option<String>,
/// The desired size of the final product shot. For optimal results, the total number of pixels should be around 1,000,000. This parameter is only relevant when placement_type=automatic or placement_type=manual_placement.
#[serde(skip_serializing_if = "Option::is_none")]
pub shot_size: Option<Vec<Option<i64>>>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ProductShotOutput {
/// The generated images
/// [{"content_type":"image/png","url":"https://storage.googleapis.com/falserverless/bria/bria_product_res.png"}]
pub images: Vec<Image>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ReimagineInput {
/// Whether to use the fast model
#[serde(skip_serializing_if = "Option::is_none")]
pub fast: Option<bool>,
/// The number of iterations the model goes through to refine the generated image. This parameter is optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// How many images you would like to generate. When using any Guidance Method, Value is set to 1.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_results: Option<i64>,
/// The prompt you would like to use to generate images.
/// "A 2d illustration of a dog in a vibrant park"
pub prompt: String,
/// The same seed and the same prompt given to the same version of the model
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// The URL of the structure reference image. Use "" to leave empty. Accepted formats are jpeg, jpg, png, webp.
/// "https://storage.googleapis.com/falserverless/bria/bria_reimagine_input.png"
#[serde(skip_serializing_if = "Option::is_none")]
pub structure_image_url: Option<String>,
/// The influence of the structure reference on the generated image.
/// 0.15
#[serde(skip_serializing_if = "Option::is_none")]
pub structure_ref_influence: Option<f64>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct ReimagineOutput {
/// The generated images
/// [{"content_type":"image/png","url":"https://storage.googleapis.com/falserverless/bria/bria_reimagine_output.png"}]
pub images: Vec<Image>,
/// Seed value used for generation.
pub seed: i64,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct TextToImageRequest {
/// The aspect ratio of the image. When a guidance method is being used, the aspect ratio is defined by the guidance image and this parameter is ignored.
#[serde(skip_serializing_if = "Option::is_none")]
pub aspect_ratio: Option<String>,
/// Guidance images to use for the generation. Up to 4 guidance methods can be combined during a single inference.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance: Option<Vec<Option<GuidanceInput>>>,
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want
/// the model to stick to your prompt when looking for a related image to show you.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance_scale: Option<f64>,
/// Which medium should be included in your generated images. This parameter is optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub medium: Option<String>,
/// The negative prompt you would like to use to generate images.
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// How many images you would like to generate. When using any Guidance Method, Value is set to 1.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_images: Option<i64>,
/// The number of iterations the model goes through to refine the generated image. This parameter is optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// The prompt you would like to use to generate images.
/// "A lone figure stands on the edge of a serene cliff at sunset, gazing out over a vast, mystical valley. The figure is clad in flowing robes that ripple in the gentle breeze, silhouetted against the golden and lavender hues of the sky. Below, a cascading waterfall pours into a sparkling river winding through a forest of bioluminescent trees. The scene blends the awe of nature with a touch of otherworldly wonder, inviting reflection and imagination."
pub prompt: String,
/// When set to true, enhances the provided prompt by generating additional, more descriptive variations, resulting in more diverse and creative output images.
#[serde(skip_serializing_if = "Option::is_none")]
pub prompt_enhancement: Option<bool>,
/// The same seed and the same prompt given to the same version of the model
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct UpscaleInput {
/// The desired increase in resolution.
#[serde(skip_serializing_if = "Option::is_none")]
pub desired_increase: Option<String>,
/// Input Image to erase from
/// "https://storage.googleapis.com/falserverless/model_tests/remove_background/elephant.jpg"
pub image_url: String,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct UpscaleOutput {
/// Result Image
/// {"content_type":"image/png","file_name":"db12c5f7076844d0bb84df92ab340acd.png","file_size":2494064,"height":1400,"url":"https://v3.fal.media/files/penguin/oHW1CIjw26zf3Jt-YLBTW_db12c5f7076844d0bb84df92ab340acd.png","width":1220}
pub image: Image,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ValidationError {
pub loc: Vec<serde_json::Value>,
pub msg: String,
#[serde(rename = "type")]
pub ty: String,
}
/// Bria Text-to-Image Base
///
/// Category: text-to-image
/// Machine Type: H100
/// License Type: commercial
pub fn reimagine(params: ReimagineInput) -> FalRequest<ReimagineInput, ReimagineOutput> {
FalRequest::new("fal-ai/bria/reimagine", params)
}
@@ -0,0 +1,445 @@
#[allow(unused_imports)]
use crate::prelude::*;
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::collections::HashMap;
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct BGRemoveInput {
/// Input Image to erase from
/// "https://fal.media/files/panda/K5Rndvzmn1j-OI1VZXDVd.jpeg"
pub image_url: String,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct BGRemoveOutput {
/// The generated image
/// {"content_type":"image/png","file_name":"070c731993e949d993c10ef6283d335d.png","file_size":1076276,"height":1024,"url":"https://v3.fal.media/files/tiger/GQEMNjRyxSoza7N8LPPqb_070c731993e949d993c10ef6283d335d.png","width":1024}
pub image: Image,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct BGReplaceInput {
/// Whether to use the fast model
#[serde(skip_serializing_if = "Option::is_none")]
pub fast: Option<bool>,
/// Input Image to erase from
/// "https://storage.googleapis.com/falserverless/bria/bria_bg_replace_fg.jpg"
pub image_url: String,
/// The negative prompt you would like to use to generate images.
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// Number of Images to generate.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_images: Option<i64>,
/// The prompt you would like to use to generate images.
/// "Lilypad on a river"
#[serde(skip_serializing_if = "Option::is_none")]
pub prompt: Option<String>,
/// The URL of the reference image to be used for generating the new background. Use "" to leave empty. Either ref_image_url or bg_prompt has to be provided but not both. If both ref_image_url and ref_image_file are provided, ref_image_url will be used. Accepted formats are jpeg, jpg, png, webp.
/// "https://storage.googleapis.com/falserverless/bria/bria_bg_replace_bg.jpg"
#[serde(skip_serializing_if = "Option::is_none")]
pub ref_image_url: Option<String>,
/// Whether to refine prompt
#[serde(skip_serializing_if = "Option::is_none")]
pub refine_prompt: Option<bool>,
/// The same seed and the same prompt given to the same version of the model
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct BGReplaceOutput {
/// The generated images
/// [{"content_type":"image/png","url":"https://storage.googleapis.com/falserverless/bria/bria_bg_replace_res.jpg"}]
pub images: Vec<Image>,
/// Seed value used for generation.
pub seed: i64,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct EraserInput {
/// Input Image to erase from
/// "https://storage.googleapis.com/falserverless/bria/bria_eraser_img.png"
pub image_url: String,
/// You can use this parameter to specify the type of the input mask from the list. 'manual' opttion should be used in cases in which the mask had been generated by a user (e.g. with a brush tool), and 'automatic' mask type should be used when mask had been generated by an algorithm like 'SAM'.
#[serde(skip_serializing_if = "Option::is_none")]
pub mask_type: Option<String>,
/// The URL of the binary mask image that represents the area that will be cleaned.
/// "https://storage.googleapis.com/falserverless/bria/bria_eraser_mask.png"
pub mask_url: String,
/// If set to true, attempts to preserve the alpha channel of the input image.
#[serde(skip_serializing_if = "Option::is_none")]
pub preserve_alpha: Option<bool>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct EraserOutput {
/// The generated image
/// {"content_type":"image/png","url":"https://storage.googleapis.com/falserverless/bria/bria_eraser_res.png"}
pub image: Image,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct FastTextToImageRequest {
/// The aspect ratio of the image. When a guidance method is being used, the aspect ratio is defined by the guidance image and this parameter is ignored.
#[serde(skip_serializing_if = "Option::is_none")]
pub aspect_ratio: Option<String>,
/// Guidance images to use for the generation. Up to 4 guidance methods can be combined during a single inference.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance: Option<Vec<Option<GuidanceInput>>>,
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want
/// the model to stick to your prompt when looking for a related image to show you.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance_scale: Option<f64>,
/// Which medium should be included in your generated images. This parameter is optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub medium: Option<String>,
/// The negative prompt you would like to use to generate images.
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// How many images you would like to generate. When using any Guidance Method, Value is set to 1.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_images: Option<i64>,
/// The number of iterations the model goes through to refine the generated image. This parameter is optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// The prompt you would like to use to generate images.
/// "A lone figure stands on the edge of a serene cliff at sunset, gazing out over a vast, mystical valley. The figure is clad in flowing robes that ripple in the gentle breeze, silhouetted against the golden and lavender hues of the sky. Below, a cascading waterfall pours into a sparkling river winding through a forest of bioluminescent trees. The scene blends the awe of nature with a touch of otherworldly wonder, inviting reflection and imagination."
pub prompt: String,
/// When set to true, enhances the provided prompt by generating additional, more descriptive variations, resulting in more diverse and creative output images.
#[serde(skip_serializing_if = "Option::is_none")]
pub prompt_enhancement: Option<bool>,
/// The same seed and the same prompt given to the same version of the model
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct GenFillInput {
/// Input Image to erase from
/// "https://storage.googleapis.com/falserverless/bria/bria_genfill_img.png"
pub image_url: String,
/// The URL of the binary mask image that represents the area that will be cleaned.
/// "https://storage.googleapis.com/falserverless/bria/bria_genfill_mask.png"
pub mask_url: String,
/// The negative prompt you would like to use to generate images.
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// Number of Images to generate.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_images: Option<i64>,
/// The prompt you would like to use to generate images.
/// "A red delicious cherry"
pub prompt: String,
/// The same seed and the same prompt given to the same version of the model
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct GenFillOutput {
/// Generated Images
/// [{"content_type":"image/png","file_name":"a0d138e6820c4ad58f1fd3c758f16047.png","file_size":1064550,"height":768,"url":"https://storage.googleapis.com/falserverless/bria/bria_genfill_res.png","width":1024}]
pub images: Vec<Image>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct GuidanceInput {
/// The image that should be used as guidance, in base64 format, with the method defined in guidance_method_1. Accepted formats are jpeg, jpg, png, webp. Maximum file size 12MB. If more then one guidance method is used, all guidance images must be of the same aspect ratio, and this will be the aspect ratio of the generated results. If guidance_method_1 is selected, an image must be provided.
pub image_url: String,
/// Which guidance type you would like to include in the generation. Up to 4 guidance methods can be combined during a single inference. This parameter is optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub method: Option<String>,
/// Impact of the guidance.
#[serde(skip_serializing_if = "Option::is_none")]
pub scale: Option<f64>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct HTTPValidationError {
#[serde(skip_serializing_if = "Option::is_none")]
pub detail: Option<Vec<Option<ValidationError>>>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Image {
/// The mime type of the file.
/// "image/png"
#[serde(skip_serializing_if = "Option::is_none")]
pub content_type: Option<String>,
/// File data
#[serde(skip_serializing_if = "Option::is_none")]
pub file_data: Option<String>,
/// The name of the file. It will be auto-generated if not provided.
/// "z9RV14K95DvU.png"
#[serde(skip_serializing_if = "Option::is_none")]
pub file_name: Option<String>,
/// The size of the file in bytes.
/// 4404019
#[serde(skip_serializing_if = "Option::is_none")]
pub file_size: Option<i64>,
/// The height of the image in pixels.
/// 1024
#[serde(skip_serializing_if = "Option::is_none")]
pub height: Option<i64>,
/// The URL where the file can be downloaded from.
pub url: String,
/// The width of the image in pixels.
/// 1024
#[serde(skip_serializing_if = "Option::is_none")]
pub width: Option<i64>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ImageExpansionInput {
/// The desired size of the final image, after the expansion. should have an area of less than 5000x5000 pixels.
/// [1200,674]
pub canvas_size: Vec<i64>,
/// The URL of the input image.
/// "https://storage.googleapis.com/falserverless/model_tests/orange.png"
pub image_url: String,
/// The negative prompt you would like to use to generate images.
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// Number of Images to generate.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_images: Option<i64>,
/// The desired location of the original image, inside the full canvas. Provide the location of the upper left corner of the original image. The location can also be outside the canvas (the original image will be cropped).
/// [301,-66]
pub original_image_location: Vec<i64>,
/// The desired size of the original image, inside the full canvas. Ensure that the ratio of input image foreground or main subject to the canvas area is greater than 15% to achieve optimal results.
/// [610,855]
pub original_image_size: Vec<i64>,
/// Text on which you wish to base the image expansion. This parameter is optional. Bria currently supports prompts in English only, excluding special characters.
#[serde(skip_serializing_if = "Option::is_none")]
pub prompt: Option<String>,
/// You can choose whether you want your generated expension to be random or predictable. You can recreate the same result in the future by using the seed value of a result from the response. You can exclude this parameter if you are not interested in recreating your results. This parameter is optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ImageExpansionOutput {
/// The generated image
/// {"content_type":"image/png","file_name":"afa402a35ea742cdb5c3e219b2b19bfb.png","file_size":1471342,"height":674,"url":"https://v3.fal.media/files/koala/8np-spgxxG-I1r3cjthRV_afa402a35ea742cdb5c3e219b2b19bfb.png","width":1200}
pub image: Image,
/// Seed value used for generation.
pub seed: i64,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct Output {
/// The generated images
/// [{"content_type":"image/png","file_name":"257cf8e7bd3a47c2959396343d5b38cf.png","file_size":3731290,"height":1536,"url":"https://v3.fal.media/files/tiger/48e63e0K6C9XQYBuomoU-_257cf8e7bd3a47c2959396343d5b38cf.png","width":1536}]
pub images: Vec<Image>,
/// Seed value used for generation.
pub seed: i64,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ProductShotInput {
/// Whether to use the fast model
#[serde(skip_serializing_if = "Option::is_none")]
pub fast: Option<bool>,
/// The URL of the product shot to be placed in a lifestyle shot. If both image_url and image_file are provided, image_url will be used. Accepted formats are jpeg, jpg, png, webp. Maximum file size 12MB.
/// "https://storage.googleapis.com/falserverless/bria/bria_product_fg.jpg"
pub image_url: String,
/// If you've selected placement_type=manual_placement, you should use this parameter to specify which placements/positions you would like to use from the list. You can select more than one placement in one request.
#[serde(skip_serializing_if = "Option::is_none")]
pub manual_placement_selection: Option<String>,
/// The number of lifestyle product shots you would like to generate. You will get num_results x 10 results when placement_type=automatic and according to the number of required placements x num_results if placement_type=manual_placement.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_results: Option<i64>,
/// Whether to optimize the scene description
#[serde(skip_serializing_if = "Option::is_none")]
pub optimize_description: Option<bool>,
/// This flag is only relevant when placement_type=original. If true, the output image retains the original input image's size; otherwise, the image is scaled to 1 megapixel (1MP) while preserving its aspect ratio.
#[serde(skip_serializing_if = "Option::is_none")]
pub original_quality: Option<bool>,
/// The desired padding in pixels around the product, when using placement_type=manual_padding. The order of the values is [left, right, top, bottom]. For optimal results, the total number of pixels, including padding, should be around 1,000,000. It is recommended to first use the product cutout API, get the cutout and understand the size of the result, and then define the required padding and use the cutout as an input for this API.
#[serde(skip_serializing_if = "Option::is_none")]
pub padding_values: Option<Vec<Option<i64>>>,
/// This parameter allows you to control the positioning of the product in the image. Choosing 'original' will preserve the original position of the product in the image. Choosing 'automatic' will generate results with the 10 recommended positions for the product. Choosing 'manual_placement' will allow you to select predefined positions (using the parameter 'manual_placement_selection'). Selecting 'manual_padding' will allow you to control the position and size of the image by defining the desired padding in pixels around the product.
#[serde(skip_serializing_if = "Option::is_none")]
pub placement_type: Option<String>,
/// The URL of the reference image to be used for generating the new scene or background for the product shot. Use "" to leave empty.Either ref_image_url or scene_description has to be provided but not both. If both ref_image_url and ref_image_file are provided, ref_image_url will be used. Accepted formats are jpeg, jpg, png, webp.
/// "https://storage.googleapis.com/falserverless/bria/bria_product_bg.jpg"
#[serde(skip_serializing_if = "Option::is_none")]
pub ref_image_url: Option<String>,
/// Text description of the new scene or background for the provided product shot. Bria currently supports prompts in English only, excluding special characters.
/// "on a rock, next to the ocean, dark theme"
#[serde(skip_serializing_if = "Option::is_none")]
pub scene_description: Option<String>,
/// The desired size of the final product shot. For optimal results, the total number of pixels should be around 1,000,000. This parameter is only relevant when placement_type=automatic or placement_type=manual_placement.
#[serde(skip_serializing_if = "Option::is_none")]
pub shot_size: Option<Vec<Option<i64>>>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ProductShotOutput {
/// The generated images
/// [{"content_type":"image/png","url":"https://storage.googleapis.com/falserverless/bria/bria_product_res.png"}]
pub images: Vec<Image>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ReimagineInput {
/// Whether to use the fast model
#[serde(skip_serializing_if = "Option::is_none")]
pub fast: Option<bool>,
/// The number of iterations the model goes through to refine the generated image. This parameter is optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// How many images you would like to generate. When using any Guidance Method, Value is set to 1.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_results: Option<i64>,
/// The prompt you would like to use to generate images.
/// "A 2d illustration of a dog in a vibrant park"
pub prompt: String,
/// The same seed and the same prompt given to the same version of the model
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// The URL of the structure reference image. Use "" to leave empty. Accepted formats are jpeg, jpg, png, webp.
/// "https://storage.googleapis.com/falserverless/bria/bria_reimagine_input.png"
#[serde(skip_serializing_if = "Option::is_none")]
pub structure_image_url: Option<String>,
/// The influence of the structure reference on the generated image.
/// 0.15
#[serde(skip_serializing_if = "Option::is_none")]
pub structure_ref_influence: Option<f64>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ReimagineOutput {
/// The generated images
/// [{"content_type":"image/png","url":"https://storage.googleapis.com/falserverless/bria/bria_reimagine_output.png"}]
pub images: Vec<Image>,
/// Seed value used for generation.
pub seed: i64,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct TextToImageRequest {
/// The aspect ratio of the image. When a guidance method is being used, the aspect ratio is defined by the guidance image and this parameter is ignored.
#[serde(skip_serializing_if = "Option::is_none")]
pub aspect_ratio: Option<String>,
/// Guidance images to use for the generation. Up to 4 guidance methods can be combined during a single inference.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance: Option<Vec<Option<GuidanceInput>>>,
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want
/// the model to stick to your prompt when looking for a related image to show you.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance_scale: Option<f64>,
/// Which medium should be included in your generated images. This parameter is optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub medium: Option<String>,
/// The negative prompt you would like to use to generate images.
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// How many images you would like to generate. When using any Guidance Method, Value is set to 1.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_images: Option<i64>,
/// The number of iterations the model goes through to refine the generated image. This parameter is optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// The prompt you would like to use to generate images.
/// "A lone figure stands on the edge of a serene cliff at sunset, gazing out over a vast, mystical valley. The figure is clad in flowing robes that ripple in the gentle breeze, silhouetted against the golden and lavender hues of the sky. Below, a cascading waterfall pours into a sparkling river winding through a forest of bioluminescent trees. The scene blends the awe of nature with a touch of otherworldly wonder, inviting reflection and imagination."
pub prompt: String,
/// When set to true, enhances the provided prompt by generating additional, more descriptive variations, resulting in more diverse and creative output images.
#[serde(skip_serializing_if = "Option::is_none")]
pub prompt_enhancement: Option<bool>,
/// The same seed and the same prompt given to the same version of the model
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct UpscaleInput {
/// The desired increase in resolution.
#[serde(skip_serializing_if = "Option::is_none")]
pub desired_increase: Option<String>,
/// Input Image to erase from
/// "https://storage.googleapis.com/falserverless/model_tests/remove_background/elephant.jpg"
pub image_url: String,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct UpscaleOutput {
/// Result Image
/// {"content_type":"image/png","file_name":"db12c5f7076844d0bb84df92ab340acd.png","file_size":2494064,"height":1400,"url":"https://v3.fal.media/files/penguin/oHW1CIjw26zf3Jt-YLBTW_db12c5f7076844d0bb84df92ab340acd.png","width":1220}
pub image: Image,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ValidationError {
pub loc: Vec<serde_json::Value>,
pub msg: String,
#[serde(rename = "type")]
pub ty: String,
}
/// Bria Text-to-Image Base
///
/// Category: text-to-image
/// Machine Type: H100
/// License Type: commercial
pub fn base(params: TextToImageRequest) -> FalRequest<TextToImageRequest, Output> {
FalRequest::new("fal-ai/bria/text-to-image/base", params)
}
@@ -0,0 +1,445 @@
#[allow(unused_imports)]
use crate::prelude::*;
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::collections::HashMap;
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct BGRemoveInput {
/// Input Image to erase from
/// "https://fal.media/files/panda/K5Rndvzmn1j-OI1VZXDVd.jpeg"
pub image_url: String,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct BGRemoveOutput {
/// The generated image
/// {"content_type":"image/png","file_name":"070c731993e949d993c10ef6283d335d.png","file_size":1076276,"height":1024,"url":"https://v3.fal.media/files/tiger/GQEMNjRyxSoza7N8LPPqb_070c731993e949d993c10ef6283d335d.png","width":1024}
pub image: Image,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct BGReplaceInput {
/// Whether to use the fast model
#[serde(skip_serializing_if = "Option::is_none")]
pub fast: Option<bool>,
/// Input Image to erase from
/// "https://storage.googleapis.com/falserverless/bria/bria_bg_replace_fg.jpg"
pub image_url: String,
/// The negative prompt you would like to use to generate images.
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// Number of Images to generate.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_images: Option<i64>,
/// The prompt you would like to use to generate images.
/// "Lilypad on a river"
#[serde(skip_serializing_if = "Option::is_none")]
pub prompt: Option<String>,
/// The URL of the reference image to be used for generating the new background. Use "" to leave empty. Either ref_image_url or bg_prompt has to be provided but not both. If both ref_image_url and ref_image_file are provided, ref_image_url will be used. Accepted formats are jpeg, jpg, png, webp.
/// "https://storage.googleapis.com/falserverless/bria/bria_bg_replace_bg.jpg"
#[serde(skip_serializing_if = "Option::is_none")]
pub ref_image_url: Option<String>,
/// Whether to refine prompt
#[serde(skip_serializing_if = "Option::is_none")]
pub refine_prompt: Option<bool>,
/// The same seed and the same prompt given to the same version of the model
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct BGReplaceOutput {
/// The generated images
/// [{"content_type":"image/png","url":"https://storage.googleapis.com/falserverless/bria/bria_bg_replace_res.jpg"}]
pub images: Vec<Image>,
/// Seed value used for generation.
pub seed: i64,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct EraserInput {
/// Input Image to erase from
/// "https://storage.googleapis.com/falserverless/bria/bria_eraser_img.png"
pub image_url: String,
/// You can use this parameter to specify the type of the input mask from the list. 'manual' opttion should be used in cases in which the mask had been generated by a user (e.g. with a brush tool), and 'automatic' mask type should be used when mask had been generated by an algorithm like 'SAM'.
#[serde(skip_serializing_if = "Option::is_none")]
pub mask_type: Option<String>,
/// The URL of the binary mask image that represents the area that will be cleaned.
/// "https://storage.googleapis.com/falserverless/bria/bria_eraser_mask.png"
pub mask_url: String,
/// If set to true, attempts to preserve the alpha channel of the input image.
#[serde(skip_serializing_if = "Option::is_none")]
pub preserve_alpha: Option<bool>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct EraserOutput {
/// The generated image
/// {"content_type":"image/png","url":"https://storage.googleapis.com/falserverless/bria/bria_eraser_res.png"}
pub image: Image,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct FastTextToImageRequest {
/// The aspect ratio of the image. When a guidance method is being used, the aspect ratio is defined by the guidance image and this parameter is ignored.
#[serde(skip_serializing_if = "Option::is_none")]
pub aspect_ratio: Option<String>,
/// Guidance images to use for the generation. Up to 4 guidance methods can be combined during a single inference.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance: Option<Vec<Option<GuidanceInput>>>,
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want
/// the model to stick to your prompt when looking for a related image to show you.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance_scale: Option<f64>,
/// Which medium should be included in your generated images. This parameter is optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub medium: Option<String>,
/// The negative prompt you would like to use to generate images.
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// How many images you would like to generate. When using any Guidance Method, Value is set to 1.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_images: Option<i64>,
/// The number of iterations the model goes through to refine the generated image. This parameter is optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// The prompt you would like to use to generate images.
/// "A lone figure stands on the edge of a serene cliff at sunset, gazing out over a vast, mystical valley. The figure is clad in flowing robes that ripple in the gentle breeze, silhouetted against the golden and lavender hues of the sky. Below, a cascading waterfall pours into a sparkling river winding through a forest of bioluminescent trees. The scene blends the awe of nature with a touch of otherworldly wonder, inviting reflection and imagination."
pub prompt: String,
/// When set to true, enhances the provided prompt by generating additional, more descriptive variations, resulting in more diverse and creative output images.
#[serde(skip_serializing_if = "Option::is_none")]
pub prompt_enhancement: Option<bool>,
/// The same seed and the same prompt given to the same version of the model
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct GenFillInput {
/// Input Image to erase from
/// "https://storage.googleapis.com/falserverless/bria/bria_genfill_img.png"
pub image_url: String,
/// The URL of the binary mask image that represents the area that will be cleaned.
/// "https://storage.googleapis.com/falserverless/bria/bria_genfill_mask.png"
pub mask_url: String,
/// The negative prompt you would like to use to generate images.
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// Number of Images to generate.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_images: Option<i64>,
/// The prompt you would like to use to generate images.
/// "A red delicious cherry"
pub prompt: String,
/// The same seed and the same prompt given to the same version of the model
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct GenFillOutput {
/// Generated Images
/// [{"content_type":"image/png","file_name":"a0d138e6820c4ad58f1fd3c758f16047.png","file_size":1064550,"height":768,"url":"https://storage.googleapis.com/falserverless/bria/bria_genfill_res.png","width":1024}]
pub images: Vec<Image>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct GuidanceInput {
/// The image that should be used as guidance, in base64 format, with the method defined in guidance_method_1. Accepted formats are jpeg, jpg, png, webp. Maximum file size 12MB. If more then one guidance method is used, all guidance images must be of the same aspect ratio, and this will be the aspect ratio of the generated results. If guidance_method_1 is selected, an image must be provided.
pub image_url: String,
/// Which guidance type you would like to include in the generation. Up to 4 guidance methods can be combined during a single inference. This parameter is optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub method: Option<String>,
/// Impact of the guidance.
#[serde(skip_serializing_if = "Option::is_none")]
pub scale: Option<f64>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct HTTPValidationError {
#[serde(skip_serializing_if = "Option::is_none")]
pub detail: Option<Vec<Option<ValidationError>>>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Image {
/// The mime type of the file.
/// "image/png"
#[serde(skip_serializing_if = "Option::is_none")]
pub content_type: Option<String>,
/// File data
#[serde(skip_serializing_if = "Option::is_none")]
pub file_data: Option<String>,
/// The name of the file. It will be auto-generated if not provided.
/// "z9RV14K95DvU.png"
#[serde(skip_serializing_if = "Option::is_none")]
pub file_name: Option<String>,
/// The size of the file in bytes.
/// 4404019
#[serde(skip_serializing_if = "Option::is_none")]
pub file_size: Option<i64>,
/// The height of the image in pixels.
/// 1024
#[serde(skip_serializing_if = "Option::is_none")]
pub height: Option<i64>,
/// The URL where the file can be downloaded from.
pub url: String,
/// The width of the image in pixels.
/// 1024
#[serde(skip_serializing_if = "Option::is_none")]
pub width: Option<i64>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ImageExpansionInput {
/// The desired size of the final image, after the expansion. should have an area of less than 5000x5000 pixels.
/// [1200,674]
pub canvas_size: Vec<i64>,
/// The URL of the input image.
/// "https://storage.googleapis.com/falserverless/model_tests/orange.png"
pub image_url: String,
/// The negative prompt you would like to use to generate images.
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// Number of Images to generate.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_images: Option<i64>,
/// The desired location of the original image, inside the full canvas. Provide the location of the upper left corner of the original image. The location can also be outside the canvas (the original image will be cropped).
/// [301,-66]
pub original_image_location: Vec<i64>,
/// The desired size of the original image, inside the full canvas. Ensure that the ratio of input image foreground or main subject to the canvas area is greater than 15% to achieve optimal results.
/// [610,855]
pub original_image_size: Vec<i64>,
/// Text on which you wish to base the image expansion. This parameter is optional. Bria currently supports prompts in English only, excluding special characters.
#[serde(skip_serializing_if = "Option::is_none")]
pub prompt: Option<String>,
/// You can choose whether you want your generated expension to be random or predictable. You can recreate the same result in the future by using the seed value of a result from the response. You can exclude this parameter if you are not interested in recreating your results. This parameter is optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ImageExpansionOutput {
/// The generated image
/// {"content_type":"image/png","file_name":"afa402a35ea742cdb5c3e219b2b19bfb.png","file_size":1471342,"height":674,"url":"https://v3.fal.media/files/koala/8np-spgxxG-I1r3cjthRV_afa402a35ea742cdb5c3e219b2b19bfb.png","width":1200}
pub image: Image,
/// Seed value used for generation.
pub seed: i64,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct Output {
/// The generated images
/// [{"content_type":"image/png","file_name":"257cf8e7bd3a47c2959396343d5b38cf.png","file_size":3731290,"height":1536,"url":"https://v3.fal.media/files/tiger/48e63e0K6C9XQYBuomoU-_257cf8e7bd3a47c2959396343d5b38cf.png","width":1536}]
pub images: Vec<Image>,
/// Seed value used for generation.
pub seed: i64,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ProductShotInput {
/// Whether to use the fast model
#[serde(skip_serializing_if = "Option::is_none")]
pub fast: Option<bool>,
/// The URL of the product shot to be placed in a lifestyle shot. If both image_url and image_file are provided, image_url will be used. Accepted formats are jpeg, jpg, png, webp. Maximum file size 12MB.
/// "https://storage.googleapis.com/falserverless/bria/bria_product_fg.jpg"
pub image_url: String,
/// If you've selected placement_type=manual_placement, you should use this parameter to specify which placements/positions you would like to use from the list. You can select more than one placement in one request.
#[serde(skip_serializing_if = "Option::is_none")]
pub manual_placement_selection: Option<String>,
/// The number of lifestyle product shots you would like to generate. You will get num_results x 10 results when placement_type=automatic and according to the number of required placements x num_results if placement_type=manual_placement.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_results: Option<i64>,
/// Whether to optimize the scene description
#[serde(skip_serializing_if = "Option::is_none")]
pub optimize_description: Option<bool>,
/// This flag is only relevant when placement_type=original. If true, the output image retains the original input image's size; otherwise, the image is scaled to 1 megapixel (1MP) while preserving its aspect ratio.
#[serde(skip_serializing_if = "Option::is_none")]
pub original_quality: Option<bool>,
/// The desired padding in pixels around the product, when using placement_type=manual_padding. The order of the values is [left, right, top, bottom]. For optimal results, the total number of pixels, including padding, should be around 1,000,000. It is recommended to first use the product cutout API, get the cutout and understand the size of the result, and then define the required padding and use the cutout as an input for this API.
#[serde(skip_serializing_if = "Option::is_none")]
pub padding_values: Option<Vec<Option<i64>>>,
/// This parameter allows you to control the positioning of the product in the image. Choosing 'original' will preserve the original position of the product in the image. Choosing 'automatic' will generate results with the 10 recommended positions for the product. Choosing 'manual_placement' will allow you to select predefined positions (using the parameter 'manual_placement_selection'). Selecting 'manual_padding' will allow you to control the position and size of the image by defining the desired padding in pixels around the product.
#[serde(skip_serializing_if = "Option::is_none")]
pub placement_type: Option<String>,
/// The URL of the reference image to be used for generating the new scene or background for the product shot. Use "" to leave empty.Either ref_image_url or scene_description has to be provided but not both. If both ref_image_url and ref_image_file are provided, ref_image_url will be used. Accepted formats are jpeg, jpg, png, webp.
/// "https://storage.googleapis.com/falserverless/bria/bria_product_bg.jpg"
#[serde(skip_serializing_if = "Option::is_none")]
pub ref_image_url: Option<String>,
/// Text description of the new scene or background for the provided product shot. Bria currently supports prompts in English only, excluding special characters.
/// "on a rock, next to the ocean, dark theme"
#[serde(skip_serializing_if = "Option::is_none")]
pub scene_description: Option<String>,
/// The desired size of the final product shot. For optimal results, the total number of pixels should be around 1,000,000. This parameter is only relevant when placement_type=automatic or placement_type=manual_placement.
#[serde(skip_serializing_if = "Option::is_none")]
pub shot_size: Option<Vec<Option<i64>>>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ProductShotOutput {
/// The generated images
/// [{"content_type":"image/png","url":"https://storage.googleapis.com/falserverless/bria/bria_product_res.png"}]
pub images: Vec<Image>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ReimagineInput {
/// Whether to use the fast model
#[serde(skip_serializing_if = "Option::is_none")]
pub fast: Option<bool>,
/// The number of iterations the model goes through to refine the generated image. This parameter is optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// How many images you would like to generate. When using any Guidance Method, Value is set to 1.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_results: Option<i64>,
/// The prompt you would like to use to generate images.
/// "A 2d illustration of a dog in a vibrant park"
pub prompt: String,
/// The same seed and the same prompt given to the same version of the model
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// The URL of the structure reference image. Use "" to leave empty. Accepted formats are jpeg, jpg, png, webp.
/// "https://storage.googleapis.com/falserverless/bria/bria_reimagine_input.png"
#[serde(skip_serializing_if = "Option::is_none")]
pub structure_image_url: Option<String>,
/// The influence of the structure reference on the generated image.
/// 0.15
#[serde(skip_serializing_if = "Option::is_none")]
pub structure_ref_influence: Option<f64>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ReimagineOutput {
/// The generated images
/// [{"content_type":"image/png","url":"https://storage.googleapis.com/falserverless/bria/bria_reimagine_output.png"}]
pub images: Vec<Image>,
/// Seed value used for generation.
pub seed: i64,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct TextToImageRequest {
/// The aspect ratio of the image. When a guidance method is being used, the aspect ratio is defined by the guidance image and this parameter is ignored.
#[serde(skip_serializing_if = "Option::is_none")]
pub aspect_ratio: Option<String>,
/// Guidance images to use for the generation. Up to 4 guidance methods can be combined during a single inference.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance: Option<Vec<Option<GuidanceInput>>>,
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want
/// the model to stick to your prompt when looking for a related image to show you.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance_scale: Option<f64>,
/// Which medium should be included in your generated images. This parameter is optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub medium: Option<String>,
/// The negative prompt you would like to use to generate images.
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// How many images you would like to generate. When using any Guidance Method, Value is set to 1.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_images: Option<i64>,
/// The number of iterations the model goes through to refine the generated image. This parameter is optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// The prompt you would like to use to generate images.
/// "A lone figure stands on the edge of a serene cliff at sunset, gazing out over a vast, mystical valley. The figure is clad in flowing robes that ripple in the gentle breeze, silhouetted against the golden and lavender hues of the sky. Below, a cascading waterfall pours into a sparkling river winding through a forest of bioluminescent trees. The scene blends the awe of nature with a touch of otherworldly wonder, inviting reflection and imagination."
pub prompt: String,
/// When set to true, enhances the provided prompt by generating additional, more descriptive variations, resulting in more diverse and creative output images.
#[serde(skip_serializing_if = "Option::is_none")]
pub prompt_enhancement: Option<bool>,
/// The same seed and the same prompt given to the same version of the model
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct UpscaleInput {
/// The desired increase in resolution.
#[serde(skip_serializing_if = "Option::is_none")]
pub desired_increase: Option<String>,
/// Input Image to erase from
/// "https://storage.googleapis.com/falserverless/model_tests/remove_background/elephant.jpg"
pub image_url: String,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct UpscaleOutput {
/// Result Image
/// {"content_type":"image/png","file_name":"db12c5f7076844d0bb84df92ab340acd.png","file_size":2494064,"height":1400,"url":"https://v3.fal.media/files/penguin/oHW1CIjw26zf3Jt-YLBTW_db12c5f7076844d0bb84df92ab340acd.png","width":1220}
pub image: Image,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ValidationError {
pub loc: Vec<serde_json::Value>,
pub msg: String,
#[serde(rename = "type")]
pub ty: String,
}
/// Bria Text-to-Image Base
///
/// Category: text-to-image
/// Machine Type: H100
/// License Type: commercial
pub fn fast(params: FastTextToImageRequest) -> FalRequest<FastTextToImageRequest, Output> {
FalRequest::new("fal-ai/bria/text-to-image/fast", params)
}
@@ -0,0 +1,445 @@
#[allow(unused_imports)]
use crate::prelude::*;
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::collections::HashMap;
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct BGRemoveInput {
/// Input Image to erase from
/// "https://fal.media/files/panda/K5Rndvzmn1j-OI1VZXDVd.jpeg"
pub image_url: String,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct BGRemoveOutput {
/// The generated image
/// {"content_type":"image/png","file_name":"070c731993e949d993c10ef6283d335d.png","file_size":1076276,"height":1024,"url":"https://v3.fal.media/files/tiger/GQEMNjRyxSoza7N8LPPqb_070c731993e949d993c10ef6283d335d.png","width":1024}
pub image: Image,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct BGReplaceInput {
/// Whether to use the fast model
#[serde(skip_serializing_if = "Option::is_none")]
pub fast: Option<bool>,
/// Input Image to erase from
/// "https://storage.googleapis.com/falserverless/bria/bria_bg_replace_fg.jpg"
pub image_url: String,
/// The negative prompt you would like to use to generate images.
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// Number of Images to generate.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_images: Option<i64>,
/// The prompt you would like to use to generate images.
/// "Lilypad on a river"
#[serde(skip_serializing_if = "Option::is_none")]
pub prompt: Option<String>,
/// The URL of the reference image to be used for generating the new background. Use "" to leave empty. Either ref_image_url or bg_prompt has to be provided but not both. If both ref_image_url and ref_image_file are provided, ref_image_url will be used. Accepted formats are jpeg, jpg, png, webp.
/// "https://storage.googleapis.com/falserverless/bria/bria_bg_replace_bg.jpg"
#[serde(skip_serializing_if = "Option::is_none")]
pub ref_image_url: Option<String>,
/// Whether to refine prompt
#[serde(skip_serializing_if = "Option::is_none")]
pub refine_prompt: Option<bool>,
/// The same seed and the same prompt given to the same version of the model
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct BGReplaceOutput {
/// The generated images
/// [{"content_type":"image/png","url":"https://storage.googleapis.com/falserverless/bria/bria_bg_replace_res.jpg"}]
pub images: Vec<Image>,
/// Seed value used for generation.
pub seed: i64,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct EraserInput {
/// Input Image to erase from
/// "https://storage.googleapis.com/falserverless/bria/bria_eraser_img.png"
pub image_url: String,
/// You can use this parameter to specify the type of the input mask from the list. 'manual' opttion should be used in cases in which the mask had been generated by a user (e.g. with a brush tool), and 'automatic' mask type should be used when mask had been generated by an algorithm like 'SAM'.
#[serde(skip_serializing_if = "Option::is_none")]
pub mask_type: Option<String>,
/// The URL of the binary mask image that represents the area that will be cleaned.
/// "https://storage.googleapis.com/falserverless/bria/bria_eraser_mask.png"
pub mask_url: String,
/// If set to true, attempts to preserve the alpha channel of the input image.
#[serde(skip_serializing_if = "Option::is_none")]
pub preserve_alpha: Option<bool>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct EraserOutput {
/// The generated image
/// {"content_type":"image/png","url":"https://storage.googleapis.com/falserverless/bria/bria_eraser_res.png"}
pub image: Image,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct FastTextToImageRequest {
/// The aspect ratio of the image. When a guidance method is being used, the aspect ratio is defined by the guidance image and this parameter is ignored.
#[serde(skip_serializing_if = "Option::is_none")]
pub aspect_ratio: Option<String>,
/// Guidance images to use for the generation. Up to 4 guidance methods can be combined during a single inference.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance: Option<Vec<Option<GuidanceInput>>>,
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want
/// the model to stick to your prompt when looking for a related image to show you.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance_scale: Option<f64>,
/// Which medium should be included in your generated images. This parameter is optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub medium: Option<String>,
/// The negative prompt you would like to use to generate images.
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// How many images you would like to generate. When using any Guidance Method, Value is set to 1.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_images: Option<i64>,
/// The number of iterations the model goes through to refine the generated image. This parameter is optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// The prompt you would like to use to generate images.
/// "A lone figure stands on the edge of a serene cliff at sunset, gazing out over a vast, mystical valley. The figure is clad in flowing robes that ripple in the gentle breeze, silhouetted against the golden and lavender hues of the sky. Below, a cascading waterfall pours into a sparkling river winding through a forest of bioluminescent trees. The scene blends the awe of nature with a touch of otherworldly wonder, inviting reflection and imagination."
pub prompt: String,
/// When set to true, enhances the provided prompt by generating additional, more descriptive variations, resulting in more diverse and creative output images.
#[serde(skip_serializing_if = "Option::is_none")]
pub prompt_enhancement: Option<bool>,
/// The same seed and the same prompt given to the same version of the model
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct GenFillInput {
/// Input Image to erase from
/// "https://storage.googleapis.com/falserverless/bria/bria_genfill_img.png"
pub image_url: String,
/// The URL of the binary mask image that represents the area that will be cleaned.
/// "https://storage.googleapis.com/falserverless/bria/bria_genfill_mask.png"
pub mask_url: String,
/// The negative prompt you would like to use to generate images.
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// Number of Images to generate.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_images: Option<i64>,
/// The prompt you would like to use to generate images.
/// "A red delicious cherry"
pub prompt: String,
/// The same seed and the same prompt given to the same version of the model
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct GenFillOutput {
/// Generated Images
/// [{"content_type":"image/png","file_name":"a0d138e6820c4ad58f1fd3c758f16047.png","file_size":1064550,"height":768,"url":"https://storage.googleapis.com/falserverless/bria/bria_genfill_res.png","width":1024}]
pub images: Vec<Image>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct GuidanceInput {
/// The image that should be used as guidance, in base64 format, with the method defined in guidance_method_1. Accepted formats are jpeg, jpg, png, webp. Maximum file size 12MB. If more then one guidance method is used, all guidance images must be of the same aspect ratio, and this will be the aspect ratio of the generated results. If guidance_method_1 is selected, an image must be provided.
pub image_url: String,
/// Which guidance type you would like to include in the generation. Up to 4 guidance methods can be combined during a single inference. This parameter is optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub method: Option<String>,
/// Impact of the guidance.
#[serde(skip_serializing_if = "Option::is_none")]
pub scale: Option<f64>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct HTTPValidationError {
#[serde(skip_serializing_if = "Option::is_none")]
pub detail: Option<Vec<Option<ValidationError>>>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Image {
/// The mime type of the file.
/// "image/png"
#[serde(skip_serializing_if = "Option::is_none")]
pub content_type: Option<String>,
/// File data
#[serde(skip_serializing_if = "Option::is_none")]
pub file_data: Option<String>,
/// The name of the file. It will be auto-generated if not provided.
/// "z9RV14K95DvU.png"
#[serde(skip_serializing_if = "Option::is_none")]
pub file_name: Option<String>,
/// The size of the file in bytes.
/// 4404019
#[serde(skip_serializing_if = "Option::is_none")]
pub file_size: Option<i64>,
/// The height of the image in pixels.
/// 1024
#[serde(skip_serializing_if = "Option::is_none")]
pub height: Option<i64>,
/// The URL where the file can be downloaded from.
pub url: String,
/// The width of the image in pixels.
/// 1024
#[serde(skip_serializing_if = "Option::is_none")]
pub width: Option<i64>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ImageExpansionInput {
/// The desired size of the final image, after the expansion. should have an area of less than 5000x5000 pixels.
/// [1200,674]
pub canvas_size: Vec<i64>,
/// The URL of the input image.
/// "https://storage.googleapis.com/falserverless/model_tests/orange.png"
pub image_url: String,
/// The negative prompt you would like to use to generate images.
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// Number of Images to generate.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_images: Option<i64>,
/// The desired location of the original image, inside the full canvas. Provide the location of the upper left corner of the original image. The location can also be outside the canvas (the original image will be cropped).
/// [301,-66]
pub original_image_location: Vec<i64>,
/// The desired size of the original image, inside the full canvas. Ensure that the ratio of input image foreground or main subject to the canvas area is greater than 15% to achieve optimal results.
/// [610,855]
pub original_image_size: Vec<i64>,
/// Text on which you wish to base the image expansion. This parameter is optional. Bria currently supports prompts in English only, excluding special characters.
#[serde(skip_serializing_if = "Option::is_none")]
pub prompt: Option<String>,
/// You can choose whether you want your generated expension to be random or predictable. You can recreate the same result in the future by using the seed value of a result from the response. You can exclude this parameter if you are not interested in recreating your results. This parameter is optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ImageExpansionOutput {
/// The generated image
/// {"content_type":"image/png","file_name":"afa402a35ea742cdb5c3e219b2b19bfb.png","file_size":1471342,"height":674,"url":"https://v3.fal.media/files/koala/8np-spgxxG-I1r3cjthRV_afa402a35ea742cdb5c3e219b2b19bfb.png","width":1200}
pub image: Image,
/// Seed value used for generation.
pub seed: i64,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct Output {
/// The generated images
/// [{"content_type":"image/png","file_name":"257cf8e7bd3a47c2959396343d5b38cf.png","file_size":3731290,"height":1536,"url":"https://v3.fal.media/files/tiger/48e63e0K6C9XQYBuomoU-_257cf8e7bd3a47c2959396343d5b38cf.png","width":1536}]
pub images: Vec<Image>,
/// Seed value used for generation.
pub seed: i64,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ProductShotInput {
/// Whether to use the fast model
#[serde(skip_serializing_if = "Option::is_none")]
pub fast: Option<bool>,
/// The URL of the product shot to be placed in a lifestyle shot. If both image_url and image_file are provided, image_url will be used. Accepted formats are jpeg, jpg, png, webp. Maximum file size 12MB.
/// "https://storage.googleapis.com/falserverless/bria/bria_product_fg.jpg"
pub image_url: String,
/// If you've selected placement_type=manual_placement, you should use this parameter to specify which placements/positions you would like to use from the list. You can select more than one placement in one request.
#[serde(skip_serializing_if = "Option::is_none")]
pub manual_placement_selection: Option<String>,
/// The number of lifestyle product shots you would like to generate. You will get num_results x 10 results when placement_type=automatic and according to the number of required placements x num_results if placement_type=manual_placement.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_results: Option<i64>,
/// Whether to optimize the scene description
#[serde(skip_serializing_if = "Option::is_none")]
pub optimize_description: Option<bool>,
/// This flag is only relevant when placement_type=original. If true, the output image retains the original input image's size; otherwise, the image is scaled to 1 megapixel (1MP) while preserving its aspect ratio.
#[serde(skip_serializing_if = "Option::is_none")]
pub original_quality: Option<bool>,
/// The desired padding in pixels around the product, when using placement_type=manual_padding. The order of the values is [left, right, top, bottom]. For optimal results, the total number of pixels, including padding, should be around 1,000,000. It is recommended to first use the product cutout API, get the cutout and understand the size of the result, and then define the required padding and use the cutout as an input for this API.
#[serde(skip_serializing_if = "Option::is_none")]
pub padding_values: Option<Vec<Option<i64>>>,
/// This parameter allows you to control the positioning of the product in the image. Choosing 'original' will preserve the original position of the product in the image. Choosing 'automatic' will generate results with the 10 recommended positions for the product. Choosing 'manual_placement' will allow you to select predefined positions (using the parameter 'manual_placement_selection'). Selecting 'manual_padding' will allow you to control the position and size of the image by defining the desired padding in pixels around the product.
#[serde(skip_serializing_if = "Option::is_none")]
pub placement_type: Option<String>,
/// The URL of the reference image to be used for generating the new scene or background for the product shot. Use "" to leave empty.Either ref_image_url or scene_description has to be provided but not both. If both ref_image_url and ref_image_file are provided, ref_image_url will be used. Accepted formats are jpeg, jpg, png, webp.
/// "https://storage.googleapis.com/falserverless/bria/bria_product_bg.jpg"
#[serde(skip_serializing_if = "Option::is_none")]
pub ref_image_url: Option<String>,
/// Text description of the new scene or background for the provided product shot. Bria currently supports prompts in English only, excluding special characters.
/// "on a rock, next to the ocean, dark theme"
#[serde(skip_serializing_if = "Option::is_none")]
pub scene_description: Option<String>,
/// The desired size of the final product shot. For optimal results, the total number of pixels should be around 1,000,000. This parameter is only relevant when placement_type=automatic or placement_type=manual_placement.
#[serde(skip_serializing_if = "Option::is_none")]
pub shot_size: Option<Vec<Option<i64>>>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ProductShotOutput {
/// The generated images
/// [{"content_type":"image/png","url":"https://storage.googleapis.com/falserverless/bria/bria_product_res.png"}]
pub images: Vec<Image>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ReimagineInput {
/// Whether to use the fast model
#[serde(skip_serializing_if = "Option::is_none")]
pub fast: Option<bool>,
/// The number of iterations the model goes through to refine the generated image. This parameter is optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// How many images you would like to generate. When using any Guidance Method, Value is set to 1.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_results: Option<i64>,
/// The prompt you would like to use to generate images.
/// "A 2d illustration of a dog in a vibrant park"
pub prompt: String,
/// The same seed and the same prompt given to the same version of the model
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// The URL of the structure reference image. Use "" to leave empty. Accepted formats are jpeg, jpg, png, webp.
/// "https://storage.googleapis.com/falserverless/bria/bria_reimagine_input.png"
#[serde(skip_serializing_if = "Option::is_none")]
pub structure_image_url: Option<String>,
/// The influence of the structure reference on the generated image.
/// 0.15
#[serde(skip_serializing_if = "Option::is_none")]
pub structure_ref_influence: Option<f64>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ReimagineOutput {
/// The generated images
/// [{"content_type":"image/png","url":"https://storage.googleapis.com/falserverless/bria/bria_reimagine_output.png"}]
pub images: Vec<Image>,
/// Seed value used for generation.
pub seed: i64,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct TextToImageRequest {
/// The aspect ratio of the image. When a guidance method is being used, the aspect ratio is defined by the guidance image and this parameter is ignored.
#[serde(skip_serializing_if = "Option::is_none")]
pub aspect_ratio: Option<String>,
/// Guidance images to use for the generation. Up to 4 guidance methods can be combined during a single inference.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance: Option<Vec<Option<GuidanceInput>>>,
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want
/// the model to stick to your prompt when looking for a related image to show you.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance_scale: Option<f64>,
/// Which medium should be included in your generated images. This parameter is optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub medium: Option<String>,
/// The negative prompt you would like to use to generate images.
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// How many images you would like to generate. When using any Guidance Method, Value is set to 1.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_images: Option<i64>,
/// The number of iterations the model goes through to refine the generated image. This parameter is optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// The prompt you would like to use to generate images.
/// "A lone figure stands on the edge of a serene cliff at sunset, gazing out over a vast, mystical valley. The figure is clad in flowing robes that ripple in the gentle breeze, silhouetted against the golden and lavender hues of the sky. Below, a cascading waterfall pours into a sparkling river winding through a forest of bioluminescent trees. The scene blends the awe of nature with a touch of otherworldly wonder, inviting reflection and imagination."
pub prompt: String,
/// When set to true, enhances the provided prompt by generating additional, more descriptive variations, resulting in more diverse and creative output images.
#[serde(skip_serializing_if = "Option::is_none")]
pub prompt_enhancement: Option<bool>,
/// The same seed and the same prompt given to the same version of the model
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct UpscaleInput {
/// The desired increase in resolution.
#[serde(skip_serializing_if = "Option::is_none")]
pub desired_increase: Option<String>,
/// Input Image to erase from
/// "https://storage.googleapis.com/falserverless/model_tests/remove_background/elephant.jpg"
pub image_url: String,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct UpscaleOutput {
/// Result Image
/// {"content_type":"image/png","file_name":"db12c5f7076844d0bb84df92ab340acd.png","file_size":2494064,"height":1400,"url":"https://v3.fal.media/files/penguin/oHW1CIjw26zf3Jt-YLBTW_db12c5f7076844d0bb84df92ab340acd.png","width":1220}
pub image: Image,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ValidationError {
pub loc: Vec<serde_json::Value>,
pub msg: String,
#[serde(rename = "type")]
pub ty: String,
}
/// Bria Text-to-Image Base
///
/// Category: text-to-image
/// Machine Type: H100
/// License Type: commercial
pub fn hd(params: TextToImageRequest) -> FalRequest<TextToImageRequest, Output> {
FalRequest::new("fal-ai/bria/text-to-image/hd", params)
}
@@ -0,0 +1,42 @@
#[cfg(any(
feature = "endpoints",
feature = "endpoints_fal-ai",
feature = "endpoints_fal-ai_bria"
))]
#[cfg_attr(
docsrs,
doc(cfg(any(
feature = "endpoints",
feature = "endpoints_fal-ai",
feature = "endpoints_fal-ai_bria"
)))
)]
pub mod base;
#[cfg(any(
feature = "endpoints",
feature = "endpoints_fal-ai",
feature = "endpoints_fal-ai_bria"
))]
#[cfg_attr(
docsrs,
doc(cfg(any(
feature = "endpoints",
feature = "endpoints_fal-ai",
feature = "endpoints_fal-ai_bria"
)))
)]
pub mod fast;
#[cfg(any(
feature = "endpoints",
feature = "endpoints_fal-ai",
feature = "endpoints_fal-ai_bria"
))]
#[cfg_attr(
docsrs,
doc(cfg(any(
feature = "endpoints",
feature = "endpoints_fal-ai",
feature = "endpoints_fal-ai_bria"
)))
)]
pub mod hd;
@@ -0,0 +1,445 @@
#[allow(unused_imports)]
use crate::prelude::*;
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::collections::HashMap;
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct BGRemoveInput {
/// Input Image to erase from
/// "https://fal.media/files/panda/K5Rndvzmn1j-OI1VZXDVd.jpeg"
pub image_url: String,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct BGRemoveOutput {
/// The generated image
/// {"content_type":"image/png","file_name":"070c731993e949d993c10ef6283d335d.png","file_size":1076276,"height":1024,"url":"https://v3.fal.media/files/tiger/GQEMNjRyxSoza7N8LPPqb_070c731993e949d993c10ef6283d335d.png","width":1024}
pub image: Image,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct BGReplaceInput {
/// Whether to use the fast model
#[serde(skip_serializing_if = "Option::is_none")]
pub fast: Option<bool>,
/// Input Image to erase from
/// "https://storage.googleapis.com/falserverless/bria/bria_bg_replace_fg.jpg"
pub image_url: String,
/// The negative prompt you would like to use to generate images.
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// Number of Images to generate.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_images: Option<i64>,
/// The prompt you would like to use to generate images.
/// "Lilypad on a river"
#[serde(skip_serializing_if = "Option::is_none")]
pub prompt: Option<String>,
/// The URL of the reference image to be used for generating the new background. Use "" to leave empty. Either ref_image_url or bg_prompt has to be provided but not both. If both ref_image_url and ref_image_file are provided, ref_image_url will be used. Accepted formats are jpeg, jpg, png, webp.
/// "https://storage.googleapis.com/falserverless/bria/bria_bg_replace_bg.jpg"
#[serde(skip_serializing_if = "Option::is_none")]
pub ref_image_url: Option<String>,
/// Whether to refine prompt
#[serde(skip_serializing_if = "Option::is_none")]
pub refine_prompt: Option<bool>,
/// The same seed and the same prompt given to the same version of the model
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct BGReplaceOutput {
/// The generated images
/// [{"content_type":"image/png","url":"https://storage.googleapis.com/falserverless/bria/bria_bg_replace_res.jpg"}]
pub images: Vec<Image>,
/// Seed value used for generation.
pub seed: i64,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct EraserInput {
/// Input Image to erase from
/// "https://storage.googleapis.com/falserverless/bria/bria_eraser_img.png"
pub image_url: String,
/// You can use this parameter to specify the type of the input mask from the list. 'manual' opttion should be used in cases in which the mask had been generated by a user (e.g. with a brush tool), and 'automatic' mask type should be used when mask had been generated by an algorithm like 'SAM'.
#[serde(skip_serializing_if = "Option::is_none")]
pub mask_type: Option<String>,
/// The URL of the binary mask image that represents the area that will be cleaned.
/// "https://storage.googleapis.com/falserverless/bria/bria_eraser_mask.png"
pub mask_url: String,
/// If set to true, attempts to preserve the alpha channel of the input image.
#[serde(skip_serializing_if = "Option::is_none")]
pub preserve_alpha: Option<bool>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct EraserOutput {
/// The generated image
/// {"content_type":"image/png","url":"https://storage.googleapis.com/falserverless/bria/bria_eraser_res.png"}
pub image: Image,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct FastTextToImageRequest {
/// The aspect ratio of the image. When a guidance method is being used, the aspect ratio is defined by the guidance image and this parameter is ignored.
#[serde(skip_serializing_if = "Option::is_none")]
pub aspect_ratio: Option<String>,
/// Guidance images to use for the generation. Up to 4 guidance methods can be combined during a single inference.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance: Option<Vec<Option<GuidanceInput>>>,
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want
/// the model to stick to your prompt when looking for a related image to show you.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance_scale: Option<f64>,
/// Which medium should be included in your generated images. This parameter is optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub medium: Option<String>,
/// The negative prompt you would like to use to generate images.
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// How many images you would like to generate. When using any Guidance Method, Value is set to 1.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_images: Option<i64>,
/// The number of iterations the model goes through to refine the generated image. This parameter is optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// The prompt you would like to use to generate images.
/// "A lone figure stands on the edge of a serene cliff at sunset, gazing out over a vast, mystical valley. The figure is clad in flowing robes that ripple in the gentle breeze, silhouetted against the golden and lavender hues of the sky. Below, a cascading waterfall pours into a sparkling river winding through a forest of bioluminescent trees. The scene blends the awe of nature with a touch of otherworldly wonder, inviting reflection and imagination."
pub prompt: String,
/// When set to true, enhances the provided prompt by generating additional, more descriptive variations, resulting in more diverse and creative output images.
#[serde(skip_serializing_if = "Option::is_none")]
pub prompt_enhancement: Option<bool>,
/// The same seed and the same prompt given to the same version of the model
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct GenFillInput {
/// Input Image to erase from
/// "https://storage.googleapis.com/falserverless/bria/bria_genfill_img.png"
pub image_url: String,
/// The URL of the binary mask image that represents the area that will be cleaned.
/// "https://storage.googleapis.com/falserverless/bria/bria_genfill_mask.png"
pub mask_url: String,
/// The negative prompt you would like to use to generate images.
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// Number of Images to generate.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_images: Option<i64>,
/// The prompt you would like to use to generate images.
/// "A red delicious cherry"
pub prompt: String,
/// The same seed and the same prompt given to the same version of the model
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct GenFillOutput {
/// Generated Images
/// [{"content_type":"image/png","file_name":"a0d138e6820c4ad58f1fd3c758f16047.png","file_size":1064550,"height":768,"url":"https://storage.googleapis.com/falserverless/bria/bria_genfill_res.png","width":1024}]
pub images: Vec<Image>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct GuidanceInput {
/// The image that should be used as guidance, in base64 format, with the method defined in guidance_method_1. Accepted formats are jpeg, jpg, png, webp. Maximum file size 12MB. If more then one guidance method is used, all guidance images must be of the same aspect ratio, and this will be the aspect ratio of the generated results. If guidance_method_1 is selected, an image must be provided.
pub image_url: String,
/// Which guidance type you would like to include in the generation. Up to 4 guidance methods can be combined during a single inference. This parameter is optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub method: Option<String>,
/// Impact of the guidance.
#[serde(skip_serializing_if = "Option::is_none")]
pub scale: Option<f64>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct HTTPValidationError {
#[serde(skip_serializing_if = "Option::is_none")]
pub detail: Option<Vec<Option<ValidationError>>>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Image {
/// The mime type of the file.
/// "image/png"
#[serde(skip_serializing_if = "Option::is_none")]
pub content_type: Option<String>,
/// File data
#[serde(skip_serializing_if = "Option::is_none")]
pub file_data: Option<String>,
/// The name of the file. It will be auto-generated if not provided.
/// "z9RV14K95DvU.png"
#[serde(skip_serializing_if = "Option::is_none")]
pub file_name: Option<String>,
/// The size of the file in bytes.
/// 4404019
#[serde(skip_serializing_if = "Option::is_none")]
pub file_size: Option<i64>,
/// The height of the image in pixels.
/// 1024
#[serde(skip_serializing_if = "Option::is_none")]
pub height: Option<i64>,
/// The URL where the file can be downloaded from.
pub url: String,
/// The width of the image in pixels.
/// 1024
#[serde(skip_serializing_if = "Option::is_none")]
pub width: Option<i64>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ImageExpansionInput {
/// The desired size of the final image, after the expansion. should have an area of less than 5000x5000 pixels.
/// [1200,674]
pub canvas_size: Vec<i64>,
/// The URL of the input image.
/// "https://storage.googleapis.com/falserverless/model_tests/orange.png"
pub image_url: String,
/// The negative prompt you would like to use to generate images.
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// Number of Images to generate.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_images: Option<i64>,
/// The desired location of the original image, inside the full canvas. Provide the location of the upper left corner of the original image. The location can also be outside the canvas (the original image will be cropped).
/// [301,-66]
pub original_image_location: Vec<i64>,
/// The desired size of the original image, inside the full canvas. Ensure that the ratio of input image foreground or main subject to the canvas area is greater than 15% to achieve optimal results.
/// [610,855]
pub original_image_size: Vec<i64>,
/// Text on which you wish to base the image expansion. This parameter is optional. Bria currently supports prompts in English only, excluding special characters.
#[serde(skip_serializing_if = "Option::is_none")]
pub prompt: Option<String>,
/// You can choose whether you want your generated expension to be random or predictable. You can recreate the same result in the future by using the seed value of a result from the response. You can exclude this parameter if you are not interested in recreating your results. This parameter is optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ImageExpansionOutput {
/// The generated image
/// {"content_type":"image/png","file_name":"afa402a35ea742cdb5c3e219b2b19bfb.png","file_size":1471342,"height":674,"url":"https://v3.fal.media/files/koala/8np-spgxxG-I1r3cjthRV_afa402a35ea742cdb5c3e219b2b19bfb.png","width":1200}
pub image: Image,
/// Seed value used for generation.
pub seed: i64,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Output {
/// The generated images
/// [{"content_type":"image/png","file_name":"257cf8e7bd3a47c2959396343d5b38cf.png","file_size":3731290,"height":1536,"url":"https://v3.fal.media/files/tiger/48e63e0K6C9XQYBuomoU-_257cf8e7bd3a47c2959396343d5b38cf.png","width":1536}]
pub images: Vec<Image>,
/// Seed value used for generation.
pub seed: i64,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ProductShotInput {
/// Whether to use the fast model
#[serde(skip_serializing_if = "Option::is_none")]
pub fast: Option<bool>,
/// The URL of the product shot to be placed in a lifestyle shot. If both image_url and image_file are provided, image_url will be used. Accepted formats are jpeg, jpg, png, webp. Maximum file size 12MB.
/// "https://storage.googleapis.com/falserverless/bria/bria_product_fg.jpg"
pub image_url: String,
/// If you've selected placement_type=manual_placement, you should use this parameter to specify which placements/positions you would like to use from the list. You can select more than one placement in one request.
#[serde(skip_serializing_if = "Option::is_none")]
pub manual_placement_selection: Option<String>,
/// The number of lifestyle product shots you would like to generate. You will get num_results x 10 results when placement_type=automatic and according to the number of required placements x num_results if placement_type=manual_placement.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_results: Option<i64>,
/// Whether to optimize the scene description
#[serde(skip_serializing_if = "Option::is_none")]
pub optimize_description: Option<bool>,
/// This flag is only relevant when placement_type=original. If true, the output image retains the original input image's size; otherwise, the image is scaled to 1 megapixel (1MP) while preserving its aspect ratio.
#[serde(skip_serializing_if = "Option::is_none")]
pub original_quality: Option<bool>,
/// The desired padding in pixels around the product, when using placement_type=manual_padding. The order of the values is [left, right, top, bottom]. For optimal results, the total number of pixels, including padding, should be around 1,000,000. It is recommended to first use the product cutout API, get the cutout and understand the size of the result, and then define the required padding and use the cutout as an input for this API.
#[serde(skip_serializing_if = "Option::is_none")]
pub padding_values: Option<Vec<Option<i64>>>,
/// This parameter allows you to control the positioning of the product in the image. Choosing 'original' will preserve the original position of the product in the image. Choosing 'automatic' will generate results with the 10 recommended positions for the product. Choosing 'manual_placement' will allow you to select predefined positions (using the parameter 'manual_placement_selection'). Selecting 'manual_padding' will allow you to control the position and size of the image by defining the desired padding in pixels around the product.
#[serde(skip_serializing_if = "Option::is_none")]
pub placement_type: Option<String>,
/// The URL of the reference image to be used for generating the new scene or background for the product shot. Use "" to leave empty.Either ref_image_url or scene_description has to be provided but not both. If both ref_image_url and ref_image_file are provided, ref_image_url will be used. Accepted formats are jpeg, jpg, png, webp.
/// "https://storage.googleapis.com/falserverless/bria/bria_product_bg.jpg"
#[serde(skip_serializing_if = "Option::is_none")]
pub ref_image_url: Option<String>,
/// Text description of the new scene or background for the provided product shot. Bria currently supports prompts in English only, excluding special characters.
/// "on a rock, next to the ocean, dark theme"
#[serde(skip_serializing_if = "Option::is_none")]
pub scene_description: Option<String>,
/// The desired size of the final product shot. For optimal results, the total number of pixels should be around 1,000,000. This parameter is only relevant when placement_type=automatic or placement_type=manual_placement.
#[serde(skip_serializing_if = "Option::is_none")]
pub shot_size: Option<Vec<Option<i64>>>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ProductShotOutput {
/// The generated images
/// [{"content_type":"image/png","url":"https://storage.googleapis.com/falserverless/bria/bria_product_res.png"}]
pub images: Vec<Image>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ReimagineInput {
/// Whether to use the fast model
#[serde(skip_serializing_if = "Option::is_none")]
pub fast: Option<bool>,
/// The number of iterations the model goes through to refine the generated image. This parameter is optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// How many images you would like to generate. When using any Guidance Method, Value is set to 1.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_results: Option<i64>,
/// The prompt you would like to use to generate images.
/// "A 2d illustration of a dog in a vibrant park"
pub prompt: String,
/// The same seed and the same prompt given to the same version of the model
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// The URL of the structure reference image. Use "" to leave empty. Accepted formats are jpeg, jpg, png, webp.
/// "https://storage.googleapis.com/falserverless/bria/bria_reimagine_input.png"
#[serde(skip_serializing_if = "Option::is_none")]
pub structure_image_url: Option<String>,
/// The influence of the structure reference on the generated image.
/// 0.15
#[serde(skip_serializing_if = "Option::is_none")]
pub structure_ref_influence: Option<f64>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ReimagineOutput {
/// The generated images
/// [{"content_type":"image/png","url":"https://storage.googleapis.com/falserverless/bria/bria_reimagine_output.png"}]
pub images: Vec<Image>,
/// Seed value used for generation.
pub seed: i64,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct TextToImageRequest {
/// The aspect ratio of the image. When a guidance method is being used, the aspect ratio is defined by the guidance image and this parameter is ignored.
#[serde(skip_serializing_if = "Option::is_none")]
pub aspect_ratio: Option<String>,
/// Guidance images to use for the generation. Up to 4 guidance methods can be combined during a single inference.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance: Option<Vec<Option<GuidanceInput>>>,
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want
/// the model to stick to your prompt when looking for a related image to show you.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance_scale: Option<f64>,
/// Which medium should be included in your generated images. This parameter is optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub medium: Option<String>,
/// The negative prompt you would like to use to generate images.
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// How many images you would like to generate. When using any Guidance Method, Value is set to 1.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_images: Option<i64>,
/// The number of iterations the model goes through to refine the generated image. This parameter is optional.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// The prompt you would like to use to generate images.
/// "A lone figure stands on the edge of a serene cliff at sunset, gazing out over a vast, mystical valley. The figure is clad in flowing robes that ripple in the gentle breeze, silhouetted against the golden and lavender hues of the sky. Below, a cascading waterfall pours into a sparkling river winding through a forest of bioluminescent trees. The scene blends the awe of nature with a touch of otherworldly wonder, inviting reflection and imagination."
pub prompt: String,
/// When set to true, enhances the provided prompt by generating additional, more descriptive variations, resulting in more diverse and creative output images.
#[serde(skip_serializing_if = "Option::is_none")]
pub prompt_enhancement: Option<bool>,
/// The same seed and the same prompt given to the same version of the model
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct UpscaleInput {
/// The desired increase in resolution.
#[serde(skip_serializing_if = "Option::is_none")]
pub desired_increase: Option<String>,
/// Input Image to erase from
/// "https://storage.googleapis.com/falserverless/model_tests/remove_background/elephant.jpg"
pub image_url: String,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct UpscaleOutput {
/// Result Image
/// {"content_type":"image/png","file_name":"db12c5f7076844d0bb84df92ab340acd.png","file_size":2494064,"height":1400,"url":"https://v3.fal.media/files/penguin/oHW1CIjw26zf3Jt-YLBTW_db12c5f7076844d0bb84df92ab340acd.png","width":1220}
pub image: Image,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ValidationError {
pub loc: Vec<serde_json::Value>,
pub msg: String,
#[serde(rename = "type")]
pub ty: String,
}
/// Bria Text-to-Image Base
///
/// Category: text-to-image
/// Machine Type: H100
/// License Type: commercial
pub fn upscale(params: UpscaleInput) -> FalRequest<UpscaleInput, UpscaleOutput> {
FalRequest::new("fal-ai/bria/upscale", params)
}
@@ -0,0 +1,131 @@
#[allow(unused_imports)]
use crate::prelude::*;
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::collections::HashMap;
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct CATVTONInput {
/// Type of the Cloth to be tried on.
///
/// Options:
/// upper: Upper body cloth
/// lower: Lower body cloth
/// overall: Full body cloth
/// inner: Inner cloth, like T-shirt inside a jacket
/// outer: Outer cloth, like a jacket over a T-shirt
/// "upper"
/// "lower"
/// "overall"
/// "inner"
/// "outer"
pub cloth_type: String,
/// Url to the garment image.
/// "https://storage.googleapis.com/falserverless/catvton/tshirt.jpg"
pub garment_image_url: String,
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want
/// the model to stick to your prompt when looking for a related image to show you.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance_scale: Option<f64>,
/// Url for the human image.
/// "https://storage.googleapis.com/falserverless/catvton/man5.jpg"
pub human_image_url: String,
/// The size of the generated image.
#[serde(skip_serializing_if = "Option::is_none")]
pub image_size: Option<ImageSizeProperty>,
/// The number of inference steps to perform.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// The same seed and the same input given to the same version of the model
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct CATVTONOutput {
/// The output image.
pub image: Image,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct HTTPValidationError {
#[serde(skip_serializing_if = "Option::is_none")]
pub detail: Option<Vec<Option<ValidationError>>>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Image {
/// The mime type of the file.
/// "image/png"
#[serde(skip_serializing_if = "Option::is_none")]
pub content_type: Option<String>,
/// File data
#[serde(skip_serializing_if = "Option::is_none")]
pub file_data: Option<String>,
/// The name of the file. It will be auto-generated if not provided.
/// "z9RV14K95DvU.png"
#[serde(skip_serializing_if = "Option::is_none")]
pub file_name: Option<String>,
/// The size of the file in bytes.
/// 4404019
#[serde(skip_serializing_if = "Option::is_none")]
pub file_size: Option<i64>,
/// The height of the image in pixels.
/// 1024
#[serde(skip_serializing_if = "Option::is_none")]
pub height: Option<i64>,
/// The URL where the file can be downloaded from.
pub url: String,
/// The width of the image in pixels.
/// 1024
#[serde(skip_serializing_if = "Option::is_none")]
pub width: Option<i64>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ImageSize {
/// The height of the generated image.
#[serde(skip_serializing_if = "Option::is_none")]
pub height: Option<i64>,
/// The width of the generated image.
#[serde(skip_serializing_if = "Option::is_none")]
pub width: Option<i64>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ValidationError {
pub loc: Vec<serde_json::Value>,
pub msg: String,
#[serde(rename = "type")]
pub ty: String,
}
#[derive(Debug, Serialize, Deserialize, smart_default::SmartDefault)]
#[allow(non_camel_case_types)]
pub enum ImageSizeProperty {
#[default]
ImageSize(ImageSize),
#[serde(rename = "square_hd")]
SquareHd,
#[serde(rename = "square")]
Square,
#[serde(rename = "portrait_4_3")]
Portrait43,
#[serde(rename = "portrait_16_9")]
Portrait169,
#[serde(rename = "landscape_4_3")]
Landscape43,
#[serde(rename = "landscape_16_9")]
Landscape169,
}
/// try-on
///
/// Category: image-to-image
/// Machine Type: A100
/// License Type: research
pub fn cat_vton(params: CATVTONInput) -> FalRequest<CATVTONInput, CATVTONOutput> {
FalRequest::new("fal-ai/cat-vton", params)
}
+114
View File
@@ -0,0 +1,114 @@
#[allow(unused_imports)]
use crate::prelude::*;
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::collections::HashMap;
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct CCSRInput {
/// Type of color correction for samples.
/// "adain"
/// "wavelet"
/// "none"
#[serde(skip_serializing_if = "Option::is_none")]
pub color_fix_type: Option<String>,
/// The text prompt you would like to convert to speech.
/// "https://storage.googleapis.com/falserverless/gallery/blue-bird.jpeg"
pub image_url: String,
/// The scale of the output image. The higher the scale, the bigger the output image will be.
#[serde(skip_serializing_if = "Option::is_none")]
pub scale: Option<f64>,
/// Seed for reproducibility. Different seeds will make slightly different results.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// The number of steps to run the model for. The higher the number the better the quality and longer it will take to generate.
#[serde(skip_serializing_if = "Option::is_none")]
pub steps: Option<i64>,
/// The ending point of uniform sampling strategy.
#[serde(skip_serializing_if = "Option::is_none")]
pub t_max: Option<f64>,
/// The starting point of uniform sampling strategy.
#[serde(skip_serializing_if = "Option::is_none")]
pub t_min: Option<f64>,
/// If specified, a patch-based sampling strategy will be used for sampling.
/// "none"
/// "mix"
/// "gaussian"
#[serde(skip_serializing_if = "Option::is_none")]
pub tile_diffusion: Option<String>,
/// Size of patch.
#[serde(skip_serializing_if = "Option::is_none")]
pub tile_diffusion_size: Option<i64>,
/// Stride of sliding patch.
#[serde(skip_serializing_if = "Option::is_none")]
pub tile_diffusion_stride: Option<i64>,
/// If specified, a patch-based sampling strategy will be used for VAE decoding.
#[serde(skip_serializing_if = "Option::is_none")]
pub tile_vae: Option<bool>,
/// Size of VAE patch.
#[serde(skip_serializing_if = "Option::is_none")]
pub tile_vae_decoder_size: Option<i64>,
/// Size of latent image
#[serde(skip_serializing_if = "Option::is_none")]
pub tile_vae_encoder_size: Option<i64>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct CCSROutput {
/// The generated image file info.
pub image: Image,
/// The seed used for the generation.
pub seed: i64,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct HTTPValidationError {
#[serde(skip_serializing_if = "Option::is_none")]
pub detail: Option<Vec<Option<ValidationError>>>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Image {
/// The mime type of the file.
/// "image/png"
#[serde(skip_serializing_if = "Option::is_none")]
pub content_type: Option<String>,
/// File data
#[serde(skip_serializing_if = "Option::is_none")]
pub file_data: Option<String>,
/// The name of the file. It will be auto-generated if not provided.
/// "z9RV14K95DvU.png"
#[serde(skip_serializing_if = "Option::is_none")]
pub file_name: Option<String>,
/// The size of the file in bytes.
/// 4404019
#[serde(skip_serializing_if = "Option::is_none")]
pub file_size: Option<i64>,
/// The height of the image in pixels.
/// 1024
#[serde(skip_serializing_if = "Option::is_none")]
pub height: Option<i64>,
/// The URL where the file can be downloaded from.
pub url: String,
/// The width of the image in pixels.
/// 1024
#[serde(skip_serializing_if = "Option::is_none")]
pub width: Option<i64>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ValidationError {
pub loc: Vec<serde_json::Value>,
pub msg: String,
#[serde(rename = "type")]
pub ty: String,
}
/// CCSR Upscaler
///
/// Category: image-to-image
/// Machine Type: A100
pub fn ccsr(params: CCSRInput) -> FalRequest<CCSRInput, CCSROutput> {
FalRequest::new("fal-ai/ccsr", params)
}
@@ -0,0 +1,159 @@
#[allow(unused_imports)]
use crate::prelude::*;
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::collections::HashMap;
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct HTTPValidationError {
#[serde(skip_serializing_if = "Option::is_none")]
pub detail: Option<Vec<Option<ValidationError>>>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Image {
/// The mime type of the file.
/// "image/png"
#[serde(skip_serializing_if = "Option::is_none")]
pub content_type: Option<ContentTypeProperty>,
/// The name of the file. It will be auto-generated if not provided.
/// "z9RV14K95DvU.png"
#[serde(skip_serializing_if = "Option::is_none")]
pub file_name: Option<FileNameProperty>,
/// The size of the file in bytes.
/// 4404019
#[serde(skip_serializing_if = "Option::is_none")]
pub file_size: Option<FileSizeProperty>,
/// The height of the image in pixels.
/// 1024
#[serde(skip_serializing_if = "Option::is_none")]
pub height: Option<HeightProperty>,
/// The URL where the file can be downloaded from.
pub url: String,
/// The width of the image in pixels.
/// 1024
#[serde(skip_serializing_if = "Option::is_none")]
pub width: Option<WidthProperty>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Input {
/// The creativity of the model. The higher the creativity, the more the model will deviate from the prompt.
/// Refers to the denoise strength of the sampling.
#[serde(skip_serializing_if = "Option::is_none")]
pub creativity: Option<f64>,
/// If set to false, the safety checker will be disabled.
#[serde(skip_serializing_if = "Option::is_none")]
pub enable_safety_checker: Option<bool>,
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want
/// the model to stick to your prompt when looking for a related image to show you.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance_scale: Option<f64>,
/// The URL of the image to upscale.
/// "https://storage.googleapis.com/falserverless/gallery/NOCA_Mick-Thompson.resized.resized.jpg"
pub image_url: String,
/// The negative prompt to use. Use it to address details that you don't want in the image.
/// "(worst quality, low quality, normal quality:2)"
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// The number of inference steps to perform.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// The prompt to use for generating the image. Be as descriptive as possible for best results.
/// "masterpiece, best quality, highres"
#[serde(skip_serializing_if = "Option::is_none")]
pub prompt: Option<String>,
/// The resemblance of the upscaled image to the original image. The higher the resemblance, the more the model will try to keep the original image.
/// Refers to the strength of the ControlNet.
#[serde(skip_serializing_if = "Option::is_none")]
pub resemblance: Option<f64>,
/// The same seed and the same prompt given to the same version of Stable Diffusion
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<SeedProperty>,
/// The upscale factor
#[serde(skip_serializing_if = "Option::is_none")]
pub upscale_factor: Option<f64>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct Output {
/// The URL of the generated image.
pub image: Image,
/// The seed used to generate the image.
pub seed: i64,
/// The timings of the different steps in the workflow.
pub timings: Timings,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ValidationError {
pub loc: Vec<serde_json::Value>,
pub msg: String,
#[serde(rename = "type")]
pub ty: String,
}
#[derive(Debug, Serialize, Deserialize, smart_default::SmartDefault)]
#[allow(non_camel_case_types)]
pub enum ContentTypeProperty {
#[default]
String(String),
Null(serde_json::Value),
}
#[derive(Debug, Serialize, Deserialize, smart_default::SmartDefault)]
#[allow(non_camel_case_types)]
pub enum FileNameProperty {
#[default]
String(String),
Null(serde_json::Value),
}
#[derive(Debug, Serialize, Deserialize, smart_default::SmartDefault)]
#[allow(non_camel_case_types)]
pub enum FileSizeProperty {
#[default]
Integer(i64),
Null(serde_json::Value),
}
#[derive(Debug, Serialize, Deserialize, smart_default::SmartDefault)]
#[allow(non_camel_case_types)]
pub enum HeightProperty {
#[default]
Integer(i64),
Null(serde_json::Value),
}
#[derive(Debug, Serialize, Deserialize, smart_default::SmartDefault)]
#[allow(non_camel_case_types)]
pub enum SeedProperty {
#[default]
Integer(i64),
Null(serde_json::Value),
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Timings {
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(rename = "type")]
pub ty: Option<serde_json::Value>,
}
#[derive(Debug, Serialize, Deserialize, smart_default::SmartDefault)]
#[allow(non_camel_case_types)]
pub enum WidthProperty {
#[default]
Integer(i64),
Null(serde_json::Value),
}
/// Clarity Upscaler
///
/// Category: image-to-image
/// Machine Type: A100
pub fn clarity_upscaler(params: Input) -> FalRequest<Input, Output> {
FalRequest::new("fal-ai/clarity-upscaler", params)
}
@@ -0,0 +1,92 @@
#[allow(unused_imports)]
use crate::prelude::*;
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::collections::HashMap;
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct CodeformerInput {
/// Should faces etc should be aligned.
#[serde(skip_serializing_if = "Option::is_none")]
pub aligned: Option<bool>,
/// Should faces be upscaled
#[serde(skip_serializing_if = "Option::is_none")]
pub face_upscale: Option<bool>,
/// Weight of the fidelity factor.
#[serde(skip_serializing_if = "Option::is_none")]
pub fidelity: Option<f64>,
/// URL of image to be used for relighting
/// "https://storage.googleapis.com/falserverless/model_tests/codeformer/codeformer_poor_1.jpeg"
pub image_url: String,
/// Should only center face be restored
#[serde(skip_serializing_if = "Option::is_none")]
pub only_center_face: Option<bool>,
/// Random seed for reproducible generation.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// Upscaling factor
#[serde(skip_serializing_if = "Option::is_none")]
pub upscaling: Option<f64>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct ConformerOutput {
/// The generated image file info.
/// {"content_type":"image/png","file_name":"36d3ca4791a647678b2ff01a35c87f5a.png","file_size":423052,"height":512,"url":"https://storage.googleapis.com/falserverless/model_tests/codeformer/codeformer_restored_1.jpeg","width":512}
pub image: Image,
/// Seed of the generated Image. It will be the same value of the one passed in the
/// input or the randomly generated that was used in case none was passed.
pub seed: i64,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct HTTPValidationError {
#[serde(skip_serializing_if = "Option::is_none")]
pub detail: Option<Vec<Option<ValidationError>>>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Image {
/// The mime type of the file.
/// "image/png"
#[serde(skip_serializing_if = "Option::is_none")]
pub content_type: Option<String>,
/// File data
#[serde(skip_serializing_if = "Option::is_none")]
pub file_data: Option<String>,
/// The name of the file. It will be auto-generated if not provided.
/// "z9RV14K95DvU.png"
#[serde(skip_serializing_if = "Option::is_none")]
pub file_name: Option<String>,
/// The size of the file in bytes.
/// 4404019
#[serde(skip_serializing_if = "Option::is_none")]
pub file_size: Option<i64>,
/// The height of the image in pixels.
/// 1024
#[serde(skip_serializing_if = "Option::is_none")]
pub height: Option<i64>,
/// The URL where the file can be downloaded from.
pub url: String,
/// The width of the image in pixels.
/// 1024
#[serde(skip_serializing_if = "Option::is_none")]
pub width: Option<i64>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ValidationError {
pub loc: Vec<serde_json::Value>,
pub msg: String,
#[serde(rename = "type")]
pub ty: String,
}
/// CodeFormer
///
/// Category: image-to-image
/// Machine Type: A6000
pub fn codeformer(params: CodeformerInput) -> FalRequest<CodeformerInput, ConformerOutput> {
FalRequest::new("fal-ai/codeformer", params)
}
@@ -0,0 +1,224 @@
#[allow(unused_imports)]
use crate::prelude::*;
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::collections::HashMap;
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct BaseInput {
/// The target FPS of the video
#[serde(skip_serializing_if = "Option::is_none")]
pub export_fps: Option<i64>,
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want
/// the model to stick to your prompt when looking for a related video to show you.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance_scale: Option<f64>,
/// The LoRAs to use for the image generation. We currently support one lora.
#[serde(skip_serializing_if = "Option::is_none")]
pub loras: Option<Vec<Option<LoraWeight>>>,
/// The negative prompt to generate video from
/// "Distorted, discontinuous, Ugly, blurry, low resolution, motionless, static, disfigured, disconnected limbs, Ugly faces, incomplete arms"
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// The number of inference steps to perform.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// The prompt to generate the video from.
/// "A garden comes to life as a kaleidoscope of butterflies flutters amidst the blossoms, their delicate wings casting shadows on the petals below. In the background, a grand fountain cascades water with a gentle splendor, its rhythmic sound providing a soothing backdrop. Beneath the cool shade of a mature tree, a solitary wooden chair invites solitude and reflection, its smooth surface worn by the touch of countless visitors seeking a moment of tranquility in nature's embrace."
pub prompt: String,
/// The same seed and the same prompt given to the same version of the model
/// will output the same video every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// Use RIFE for video interpolation
#[serde(skip_serializing_if = "Option::is_none")]
pub use_rife: Option<bool>,
/// The size of the generated video.
#[serde(skip_serializing_if = "Option::is_none")]
pub video_size: Option<VideoSizeProperty>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct File {
/// The mime type of the file.
/// "image/png"
#[serde(skip_serializing_if = "Option::is_none")]
pub content_type: Option<String>,
/// File data
#[serde(skip_serializing_if = "Option::is_none")]
pub file_data: Option<String>,
/// The name of the file. It will be auto-generated if not provided.
/// "z9RV14K95DvU.png"
#[serde(skip_serializing_if = "Option::is_none")]
pub file_name: Option<String>,
/// The size of the file in bytes.
/// 4404019
#[serde(skip_serializing_if = "Option::is_none")]
pub file_size: Option<i64>,
/// The URL where the file can be downloaded from.
pub url: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct HTTPValidationError {
#[serde(skip_serializing_if = "Option::is_none")]
pub detail: Option<Vec<Option<ValidationError>>>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ImageSize {
/// The height of the generated image.
#[serde(skip_serializing_if = "Option::is_none")]
pub height: Option<i64>,
/// The width of the generated image.
#[serde(skip_serializing_if = "Option::is_none")]
pub width: Option<i64>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ImageToVideoInput {
/// The target FPS of the video
#[serde(skip_serializing_if = "Option::is_none")]
pub export_fps: Option<i64>,
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want
/// the model to stick to your prompt when looking for a related video to show you.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance_scale: Option<f64>,
/// The URL to the image to generate the video from.
/// "https://d3phaj0sisr2ct.cloudfront.net/research/eugene.jpg"
pub image_url: String,
/// The LoRAs to use for the image generation. We currently support one lora.
#[serde(skip_serializing_if = "Option::is_none")]
pub loras: Option<Vec<Option<LoraWeight>>>,
/// The negative prompt to generate video from
/// "Distorted, discontinuous, Ugly, blurry, low resolution, motionless, static, disfigured, disconnected limbs, Ugly faces, incomplete arms"
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// The number of inference steps to perform.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// The prompt to generate the video from.
/// "A low angle shot of a man walking down a street, illuminated by the neon signs of the bars around him"
pub prompt: String,
/// The same seed and the same prompt given to the same version of the model
/// will output the same video every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// Use RIFE for video interpolation
#[serde(skip_serializing_if = "Option::is_none")]
pub use_rife: Option<bool>,
/// The size of the generated video.
#[serde(skip_serializing_if = "Option::is_none")]
pub video_size: Option<VideoSizeProperty>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct LoraWeight {
/// URL or the path to the LoRA weights.
pub path: String,
/// The scale of the LoRA weight. This is used to scale the LoRA weight
/// before merging it with the base model.
#[serde(skip_serializing_if = "Option::is_none")]
pub scale: Option<f64>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct Output {
/// The prompt used for generating the video.
pub prompt: String,
/// Seed of the generated video. It will be the same value of the one passed in the
/// input or the randomly generated that was used in case none was passed.
pub seed: i64,
pub timings: Timings,
/// The URL to the generated video
pub video: File,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ValidationError {
pub loc: Vec<serde_json::Value>,
pub msg: String,
#[serde(rename = "type")]
pub ty: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct VideoToVideoInput {
/// The target FPS of the video
#[serde(skip_serializing_if = "Option::is_none")]
pub export_fps: Option<i64>,
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want
/// the model to stick to your prompt when looking for a related video to show you.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance_scale: Option<f64>,
/// The LoRAs to use for the image generation. We currently support one lora.
#[serde(skip_serializing_if = "Option::is_none")]
pub loras: Option<Vec<Option<LoraWeight>>>,
/// The negative prompt to generate video from
/// "Distorted, discontinuous, Ugly, blurry, low resolution, motionless, static, disfigured, disconnected limbs, Ugly faces, incomplete arms"
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// The number of inference steps to perform.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// The prompt to generate the video from.
/// "An astronaut stands triumphantly at the peak of a towering mountain. Panorama of rugged peaks and valleys. Very futuristic vibe and animated aesthetic. Highlights of purple and golden colors in the scene. The sky is looks like an animated/cartoonish dream of galaxies, nebulae, stars, planets, moons, but the remainder of the scene is mostly realistic. "
pub prompt: String,
/// The same seed and the same prompt given to the same version of the model
/// will output the same video every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// The strength to use for Video to Video. 1.0 completely remakes the video while 0.0 preserves the original.
#[serde(skip_serializing_if = "Option::is_none")]
pub strength: Option<f64>,
/// Use RIFE for video interpolation
#[serde(skip_serializing_if = "Option::is_none")]
pub use_rife: Option<bool>,
/// The size of the generated video.
#[serde(skip_serializing_if = "Option::is_none")]
pub video_size: Option<VideoSizeProperty>,
/// The video to generate the video from.
/// "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/hiker.mp4"
pub video_url: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Timings {
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(rename = "type")]
pub ty: Option<serde_json::Value>,
}
#[derive(Debug, Serialize, Deserialize, smart_default::SmartDefault)]
#[allow(non_camel_case_types)]
pub enum VideoSizeProperty {
#[default]
ImageSize(ImageSize),
#[serde(rename = "square_hd")]
SquareHd,
#[serde(rename = "square")]
Square,
#[serde(rename = "portrait_4_3")]
Portrait43,
#[serde(rename = "portrait_16_9")]
Portrait169,
#[serde(rename = "landscape_4_3")]
Landscape43,
#[serde(rename = "landscape_16_9")]
Landscape169,
}
/// CogVideoX-5B
///
/// Category: text-to-video
/// Machine Type: H100
///
///
/// Image to video generation using CogVideoX-5B.
pub fn image_to_video(params: ImageToVideoInput) -> FalRequest<ImageToVideoInput, Output> {
FalRequest::new("fal-ai/cogvideox-5b/image-to-video", params)
}
@@ -0,0 +1,253 @@
#[allow(unused_imports)]
use crate::prelude::*;
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::collections::HashMap;
#[cfg(any(
feature = "endpoints",
feature = "endpoints_fal-ai",
feature = "endpoints_fal-ai_cogvideox-5b"
))]
#[cfg_attr(
docsrs,
doc(cfg(any(
feature = "endpoints",
feature = "endpoints_fal-ai",
feature = "endpoints_fal-ai_cogvideox-5b"
)))
)]
pub mod image_to_video;
#[cfg(any(
feature = "endpoints",
feature = "endpoints_fal-ai",
feature = "endpoints_fal-ai_cogvideox-5b"
))]
#[cfg_attr(
docsrs,
doc(cfg(any(
feature = "endpoints",
feature = "endpoints_fal-ai",
feature = "endpoints_fal-ai_cogvideox-5b"
)))
)]
pub mod video_to_video;
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct BaseInput {
/// The target FPS of the video
#[serde(skip_serializing_if = "Option::is_none")]
pub export_fps: Option<i64>,
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want
/// the model to stick to your prompt when looking for a related video to show you.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance_scale: Option<f64>,
/// The LoRAs to use for the image generation. We currently support one lora.
#[serde(skip_serializing_if = "Option::is_none")]
pub loras: Option<Vec<Option<LoraWeight>>>,
/// The negative prompt to generate video from
/// "Distorted, discontinuous, Ugly, blurry, low resolution, motionless, static, disfigured, disconnected limbs, Ugly faces, incomplete arms"
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// The number of inference steps to perform.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// The prompt to generate the video from.
/// "A garden comes to life as a kaleidoscope of butterflies flutters amidst the blossoms, their delicate wings casting shadows on the petals below. In the background, a grand fountain cascades water with a gentle splendor, its rhythmic sound providing a soothing backdrop. Beneath the cool shade of a mature tree, a solitary wooden chair invites solitude and reflection, its smooth surface worn by the touch of countless visitors seeking a moment of tranquility in nature's embrace."
pub prompt: String,
/// The same seed and the same prompt given to the same version of the model
/// will output the same video every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// Use RIFE for video interpolation
#[serde(skip_serializing_if = "Option::is_none")]
pub use_rife: Option<bool>,
/// The size of the generated video.
#[serde(skip_serializing_if = "Option::is_none")]
pub video_size: Option<VideoSizeProperty>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct File {
/// The mime type of the file.
/// "image/png"
#[serde(skip_serializing_if = "Option::is_none")]
pub content_type: Option<String>,
/// File data
#[serde(skip_serializing_if = "Option::is_none")]
pub file_data: Option<String>,
/// The name of the file. It will be auto-generated if not provided.
/// "z9RV14K95DvU.png"
#[serde(skip_serializing_if = "Option::is_none")]
pub file_name: Option<String>,
/// The size of the file in bytes.
/// 4404019
#[serde(skip_serializing_if = "Option::is_none")]
pub file_size: Option<i64>,
/// The URL where the file can be downloaded from.
pub url: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct HTTPValidationError {
#[serde(skip_serializing_if = "Option::is_none")]
pub detail: Option<Vec<Option<ValidationError>>>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ImageSize {
/// The height of the generated image.
#[serde(skip_serializing_if = "Option::is_none")]
pub height: Option<i64>,
/// The width of the generated image.
#[serde(skip_serializing_if = "Option::is_none")]
pub width: Option<i64>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ImageToVideoInput {
/// The target FPS of the video
#[serde(skip_serializing_if = "Option::is_none")]
pub export_fps: Option<i64>,
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want
/// the model to stick to your prompt when looking for a related video to show you.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance_scale: Option<f64>,
/// The URL to the image to generate the video from.
/// "https://d3phaj0sisr2ct.cloudfront.net/research/eugene.jpg"
pub image_url: String,
/// The LoRAs to use for the image generation. We currently support one lora.
#[serde(skip_serializing_if = "Option::is_none")]
pub loras: Option<Vec<Option<LoraWeight>>>,
/// The negative prompt to generate video from
/// "Distorted, discontinuous, Ugly, blurry, low resolution, motionless, static, disfigured, disconnected limbs, Ugly faces, incomplete arms"
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// The number of inference steps to perform.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// The prompt to generate the video from.
/// "A low angle shot of a man walking down a street, illuminated by the neon signs of the bars around him"
pub prompt: String,
/// The same seed and the same prompt given to the same version of the model
/// will output the same video every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// Use RIFE for video interpolation
#[serde(skip_serializing_if = "Option::is_none")]
pub use_rife: Option<bool>,
/// The size of the generated video.
#[serde(skip_serializing_if = "Option::is_none")]
pub video_size: Option<VideoSizeProperty>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct LoraWeight {
/// URL or the path to the LoRA weights.
pub path: String,
/// The scale of the LoRA weight. This is used to scale the LoRA weight
/// before merging it with the base model.
#[serde(skip_serializing_if = "Option::is_none")]
pub scale: Option<f64>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct Output {
/// The prompt used for generating the video.
pub prompt: String,
/// Seed of the generated video. It will be the same value of the one passed in the
/// input or the randomly generated that was used in case none was passed.
pub seed: i64,
pub timings: Timings,
/// The URL to the generated video
pub video: File,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ValidationError {
pub loc: Vec<serde_json::Value>,
pub msg: String,
#[serde(rename = "type")]
pub ty: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct VideoToVideoInput {
/// The target FPS of the video
#[serde(skip_serializing_if = "Option::is_none")]
pub export_fps: Option<i64>,
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want
/// the model to stick to your prompt when looking for a related video to show you.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance_scale: Option<f64>,
/// The LoRAs to use for the image generation. We currently support one lora.
#[serde(skip_serializing_if = "Option::is_none")]
pub loras: Option<Vec<Option<LoraWeight>>>,
/// The negative prompt to generate video from
/// "Distorted, discontinuous, Ugly, blurry, low resolution, motionless, static, disfigured, disconnected limbs, Ugly faces, incomplete arms"
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// The number of inference steps to perform.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// The prompt to generate the video from.
/// "An astronaut stands triumphantly at the peak of a towering mountain. Panorama of rugged peaks and valleys. Very futuristic vibe and animated aesthetic. Highlights of purple and golden colors in the scene. The sky is looks like an animated/cartoonish dream of galaxies, nebulae, stars, planets, moons, but the remainder of the scene is mostly realistic. "
pub prompt: String,
/// The same seed and the same prompt given to the same version of the model
/// will output the same video every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// The strength to use for Video to Video. 1.0 completely remakes the video while 0.0 preserves the original.
#[serde(skip_serializing_if = "Option::is_none")]
pub strength: Option<f64>,
/// Use RIFE for video interpolation
#[serde(skip_serializing_if = "Option::is_none")]
pub use_rife: Option<bool>,
/// The size of the generated video.
#[serde(skip_serializing_if = "Option::is_none")]
pub video_size: Option<VideoSizeProperty>,
/// The video to generate the video from.
/// "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/hiker.mp4"
pub video_url: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Timings {
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(rename = "type")]
pub ty: Option<serde_json::Value>,
}
#[derive(Debug, Serialize, Deserialize, smart_default::SmartDefault)]
#[allow(non_camel_case_types)]
pub enum VideoSizeProperty {
#[default]
ImageSize(ImageSize),
#[serde(rename = "square_hd")]
SquareHd,
#[serde(rename = "square")]
Square,
#[serde(rename = "portrait_4_3")]
Portrait43,
#[serde(rename = "portrait_16_9")]
Portrait169,
#[serde(rename = "landscape_4_3")]
Landscape43,
#[serde(rename = "landscape_16_9")]
Landscape169,
}
/// CogVideoX-5B
///
/// Category: text-to-video
/// Machine Type: H100
///
///
/// CogVideoX-5B, next generation text-to-video model.
pub fn cogvideox_5b(params: BaseInput) -> FalRequest<BaseInput, Output> {
FalRequest::new("fal-ai/cogvideox-5b", params)
}
@@ -0,0 +1,224 @@
#[allow(unused_imports)]
use crate::prelude::*;
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::collections::HashMap;
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct BaseInput {
/// The target FPS of the video
#[serde(skip_serializing_if = "Option::is_none")]
pub export_fps: Option<i64>,
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want
/// the model to stick to your prompt when looking for a related video to show you.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance_scale: Option<f64>,
/// The LoRAs to use for the image generation. We currently support one lora.
#[serde(skip_serializing_if = "Option::is_none")]
pub loras: Option<Vec<Option<LoraWeight>>>,
/// The negative prompt to generate video from
/// "Distorted, discontinuous, Ugly, blurry, low resolution, motionless, static, disfigured, disconnected limbs, Ugly faces, incomplete arms"
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// The number of inference steps to perform.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// The prompt to generate the video from.
/// "A garden comes to life as a kaleidoscope of butterflies flutters amidst the blossoms, their delicate wings casting shadows on the petals below. In the background, a grand fountain cascades water with a gentle splendor, its rhythmic sound providing a soothing backdrop. Beneath the cool shade of a mature tree, a solitary wooden chair invites solitude and reflection, its smooth surface worn by the touch of countless visitors seeking a moment of tranquility in nature's embrace."
pub prompt: String,
/// The same seed and the same prompt given to the same version of the model
/// will output the same video every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// Use RIFE for video interpolation
#[serde(skip_serializing_if = "Option::is_none")]
pub use_rife: Option<bool>,
/// The size of the generated video.
#[serde(skip_serializing_if = "Option::is_none")]
pub video_size: Option<VideoSizeProperty>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct File {
/// The mime type of the file.
/// "image/png"
#[serde(skip_serializing_if = "Option::is_none")]
pub content_type: Option<String>,
/// File data
#[serde(skip_serializing_if = "Option::is_none")]
pub file_data: Option<String>,
/// The name of the file. It will be auto-generated if not provided.
/// "z9RV14K95DvU.png"
#[serde(skip_serializing_if = "Option::is_none")]
pub file_name: Option<String>,
/// The size of the file in bytes.
/// 4404019
#[serde(skip_serializing_if = "Option::is_none")]
pub file_size: Option<i64>,
/// The URL where the file can be downloaded from.
pub url: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct HTTPValidationError {
#[serde(skip_serializing_if = "Option::is_none")]
pub detail: Option<Vec<Option<ValidationError>>>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ImageSize {
/// The height of the generated image.
#[serde(skip_serializing_if = "Option::is_none")]
pub height: Option<i64>,
/// The width of the generated image.
#[serde(skip_serializing_if = "Option::is_none")]
pub width: Option<i64>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ImageToVideoInput {
/// The target FPS of the video
#[serde(skip_serializing_if = "Option::is_none")]
pub export_fps: Option<i64>,
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want
/// the model to stick to your prompt when looking for a related video to show you.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance_scale: Option<f64>,
/// The URL to the image to generate the video from.
/// "https://d3phaj0sisr2ct.cloudfront.net/research/eugene.jpg"
pub image_url: String,
/// The LoRAs to use for the image generation. We currently support one lora.
#[serde(skip_serializing_if = "Option::is_none")]
pub loras: Option<Vec<Option<LoraWeight>>>,
/// The negative prompt to generate video from
/// "Distorted, discontinuous, Ugly, blurry, low resolution, motionless, static, disfigured, disconnected limbs, Ugly faces, incomplete arms"
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// The number of inference steps to perform.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// The prompt to generate the video from.
/// "A low angle shot of a man walking down a street, illuminated by the neon signs of the bars around him"
pub prompt: String,
/// The same seed and the same prompt given to the same version of the model
/// will output the same video every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// Use RIFE for video interpolation
#[serde(skip_serializing_if = "Option::is_none")]
pub use_rife: Option<bool>,
/// The size of the generated video.
#[serde(skip_serializing_if = "Option::is_none")]
pub video_size: Option<VideoSizeProperty>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct LoraWeight {
/// URL or the path to the LoRA weights.
pub path: String,
/// The scale of the LoRA weight. This is used to scale the LoRA weight
/// before merging it with the base model.
#[serde(skip_serializing_if = "Option::is_none")]
pub scale: Option<f64>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct Output {
/// The prompt used for generating the video.
pub prompt: String,
/// Seed of the generated video. It will be the same value of the one passed in the
/// input or the randomly generated that was used in case none was passed.
pub seed: i64,
pub timings: Timings,
/// The URL to the generated video
pub video: File,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ValidationError {
pub loc: Vec<serde_json::Value>,
pub msg: String,
#[serde(rename = "type")]
pub ty: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct VideoToVideoInput {
/// The target FPS of the video
#[serde(skip_serializing_if = "Option::is_none")]
pub export_fps: Option<i64>,
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want
/// the model to stick to your prompt when looking for a related video to show you.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance_scale: Option<f64>,
/// The LoRAs to use for the image generation. We currently support one lora.
#[serde(skip_serializing_if = "Option::is_none")]
pub loras: Option<Vec<Option<LoraWeight>>>,
/// The negative prompt to generate video from
/// "Distorted, discontinuous, Ugly, blurry, low resolution, motionless, static, disfigured, disconnected limbs, Ugly faces, incomplete arms"
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// The number of inference steps to perform.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// The prompt to generate the video from.
/// "An astronaut stands triumphantly at the peak of a towering mountain. Panorama of rugged peaks and valleys. Very futuristic vibe and animated aesthetic. Highlights of purple and golden colors in the scene. The sky is looks like an animated/cartoonish dream of galaxies, nebulae, stars, planets, moons, but the remainder of the scene is mostly realistic. "
pub prompt: String,
/// The same seed and the same prompt given to the same version of the model
/// will output the same video every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// The strength to use for Video to Video. 1.0 completely remakes the video while 0.0 preserves the original.
#[serde(skip_serializing_if = "Option::is_none")]
pub strength: Option<f64>,
/// Use RIFE for video interpolation
#[serde(skip_serializing_if = "Option::is_none")]
pub use_rife: Option<bool>,
/// The size of the generated video.
#[serde(skip_serializing_if = "Option::is_none")]
pub video_size: Option<VideoSizeProperty>,
/// The video to generate the video from.
/// "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/hiker.mp4"
pub video_url: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Timings {
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(rename = "type")]
pub ty: Option<serde_json::Value>,
}
#[derive(Debug, Serialize, Deserialize, smart_default::SmartDefault)]
#[allow(non_camel_case_types)]
pub enum VideoSizeProperty {
#[default]
ImageSize(ImageSize),
#[serde(rename = "square_hd")]
SquareHd,
#[serde(rename = "square")]
Square,
#[serde(rename = "portrait_4_3")]
Portrait43,
#[serde(rename = "portrait_16_9")]
Portrait169,
#[serde(rename = "landscape_4_3")]
Landscape43,
#[serde(rename = "landscape_16_9")]
Landscape169,
}
/// CogVideoX-5B
///
/// Category: text-to-video
/// Machine Type: H100
///
///
/// Video to video generation using CogVideoX-5B.
pub fn video_to_video(params: VideoToVideoInput) -> FalRequest<VideoToVideoInput, Output> {
FalRequest::new("fal-ai/cogvideox-5b/video-to-video", params)
}
@@ -0,0 +1,149 @@
#[allow(unused_imports)]
use crate::prelude::*;
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::collections::HashMap;
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct HTTPValidationError {
#[serde(skip_serializing_if = "Option::is_none")]
pub detail: Option<Vec<Option<ValidationError>>>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Image {
/// The mime type of the file.
/// "image/png"
#[serde(skip_serializing_if = "Option::is_none")]
pub content_type: Option<String>,
/// File data
#[serde(skip_serializing_if = "Option::is_none")]
pub file_data: Option<String>,
/// The name of the file. It will be auto-generated if not provided.
/// "z9RV14K95DvU.png"
#[serde(skip_serializing_if = "Option::is_none")]
pub file_name: Option<String>,
/// The size of the file in bytes.
/// 4404019
#[serde(skip_serializing_if = "Option::is_none")]
pub file_size: Option<i64>,
/// The height of the image in pixels.
/// 1024
#[serde(skip_serializing_if = "Option::is_none")]
pub height: Option<i64>,
/// The URL where the file can be downloaded from.
pub url: String,
/// The width of the image in pixels.
/// 1024
#[serde(skip_serializing_if = "Option::is_none")]
pub width: Option<i64>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct ImageOutput {
/// Whether the generated images contain NSFW concepts.
pub has_nsfw_concepts: Vec<bool>,
/// The generated images
/// [{"content_type":"image/jpeg","height":768,"url":"https://v3.fal.media/files/tiger/rN6_PpE-o8QlSecqFku6h.jpeg","width":1024}]
pub images: Vec<Image>,
/// The prompt used for generating the image.
pub prompt: String,
/// Seed of the generated Image. It will be the same value of the one passed in the
/// input or the randomly generated that was used in case none was passed.
pub seed: i64,
pub timings: Timings,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ImageSize {
/// The height of the generated image.
#[serde(skip_serializing_if = "Option::is_none")]
pub height: Option<i64>,
/// The width of the generated image.
#[serde(skip_serializing_if = "Option::is_none")]
pub width: Option<i64>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct TextToImageInput {
/// If set to true, the safety checker will be enabled.
#[serde(skip_serializing_if = "Option::is_none")]
pub enable_safety_checker: Option<bool>,
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want
/// the model to stick to your prompt when looking for a related image to show you.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance_scale: Option<f64>,
/// The size of the generated image.
#[serde(skip_serializing_if = "Option::is_none")]
pub image_size: Option<ImageSizeProperty>,
/// The negative prompt to use. Use it to address details that you don't want
/// in the image. This could be colors, objects, scenery and even the small details
/// (e.g. moustache, blurry, low resolution).
/// ""
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// The number of images to generate.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_images: Option<i64>,
/// The number of inference steps to perform.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// The format of the generated image.
#[serde(skip_serializing_if = "Option::is_none")]
pub output_format: Option<String>,
/// The prompt to generate an image from.
/// "A vibrant and artistic digital composition featuring colorful splashes of paint in the background, creating an energetic and dynamic effect. The text 'CogView4 on Fal' is elegantly integrated into the scene, standing out with a modern, bold, and slightly futuristic font. The colors are bright and varied, including neon blues, purples, pinks, and oranges, blending seamlessly in a fluid, abstract style. The text appears slightly illuminated, complementing the vivid splashes around it."
pub prompt: String,
/// The same seed and the same prompt given to the same version of the model
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ValidationError {
pub loc: Vec<serde_json::Value>,
pub msg: String,
#[serde(rename = "type")]
pub ty: String,
}
#[derive(Debug, Serialize, Deserialize, smart_default::SmartDefault)]
#[allow(non_camel_case_types)]
pub enum ImageSizeProperty {
#[default]
ImageSize(ImageSize),
#[serde(rename = "square_hd")]
SquareHd,
#[serde(rename = "square")]
Square,
#[serde(rename = "portrait_4_3")]
Portrait43,
#[serde(rename = "portrait_16_9")]
Portrait169,
#[serde(rename = "landscape_4_3")]
Landscape43,
#[serde(rename = "landscape_16_9")]
Landscape169,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Timings {
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(rename = "type")]
pub ty: Option<serde_json::Value>,
}
/// CogView4
///
/// Category: text-to-image
/// Machine Type: H100
pub fn cogview4(params: TextToImageInput) -> FalRequest<TextToImageInput, ImageOutput> {
FalRequest::new("fal-ai/cogview4", params)
}
@@ -0,0 +1,123 @@
#[allow(unused_imports)]
use crate::prelude::*;
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::collections::HashMap;
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ControlNeXtInput {
/// Number of frames to process in each batch.
#[serde(skip_serializing_if = "Option::is_none")]
pub batch_frames: Option<i64>,
/// Condition scale for ControlNeXt.
#[serde(skip_serializing_if = "Option::is_none")]
pub controlnext_cond_scale: Option<f64>,
/// Chunk size for decoding frames.
#[serde(skip_serializing_if = "Option::is_none")]
pub decode_chunk_size: Option<i64>,
/// Frames per second for the output video.
#[serde(skip_serializing_if = "Option::is_none")]
pub fps: Option<i64>,
/// Guidance scale for the diffusion process.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance_scale: Option<f64>,
/// Height of the output video.
#[serde(skip_serializing_if = "Option::is_none")]
pub height: Option<i64>,
/// URL of the reference image.
/// "https://storage.googleapis.com/falserverless/model_tests/musepose/ref.png"
pub image_url: String,
/// Maximum number of frames to process.
#[serde(skip_serializing_if = "Option::is_none")]
pub max_frame_num: Option<i64>,
/// Motion bucket ID for the pipeline.
#[serde(skip_serializing_if = "Option::is_none")]
pub motion_bucket_id: Option<f64>,
/// Number of inference steps.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// Number of overlapping frames between batches.
#[serde(skip_serializing_if = "Option::is_none")]
pub overlap: Option<i64>,
/// Stride for sampling frames from the input video.
#[serde(skip_serializing_if = "Option::is_none")]
pub sample_stride: Option<i64>,
/// URL of the input video.
/// "https://storage.googleapis.com/falserverless/model_tests/musepose/dance.mp4"
pub video_url: String,
/// Width of the output video.
#[serde(skip_serializing_if = "Option::is_none")]
pub width: Option<i64>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct ControlNeXtOutput {
/// The generated video.
pub video: File,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct File {
/// The mime type of the file.
/// "image/png"
#[serde(skip_serializing_if = "Option::is_none")]
pub content_type: Option<ContentTypeProperty>,
/// The name of the file. It will be auto-generated if not provided.
/// "z9RV14K95DvU.png"
#[serde(skip_serializing_if = "Option::is_none")]
pub file_name: Option<FileNameProperty>,
/// The size of the file in bytes.
/// 4404019
#[serde(skip_serializing_if = "Option::is_none")]
pub file_size: Option<FileSizeProperty>,
/// The URL where the file can be downloaded from.
pub url: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct HTTPValidationError {
#[serde(skip_serializing_if = "Option::is_none")]
pub detail: Option<Vec<Option<ValidationError>>>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ValidationError {
pub loc: Vec<serde_json::Value>,
pub msg: String,
#[serde(rename = "type")]
pub ty: String,
}
#[derive(Debug, Serialize, Deserialize, smart_default::SmartDefault)]
#[allow(non_camel_case_types)]
pub enum ContentTypeProperty {
#[default]
String(String),
Null(serde_json::Value),
}
#[derive(Debug, Serialize, Deserialize, smart_default::SmartDefault)]
#[allow(non_camel_case_types)]
pub enum FileNameProperty {
#[default]
String(String),
Null(serde_json::Value),
}
#[derive(Debug, Serialize, Deserialize, smart_default::SmartDefault)]
#[allow(non_camel_case_types)]
pub enum FileSizeProperty {
#[default]
Integer(i64),
Null(serde_json::Value),
}
/// ControlNeXt SVD
///
/// Category: video-to-video
/// Machine Type: A100
/// License Type: commercial
pub fn controlnext(params: ControlNeXtInput) -> FalRequest<ControlNeXtInput, ControlNeXtOutput> {
FalRequest::new("fal-ai/controlnext", params)
}
@@ -0,0 +1,143 @@
#[allow(unused_imports)]
use crate::prelude::*;
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::collections::HashMap;
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct CreativeUpscalerInput {
/// The URL to the additional embeddings to use for the upscaling. Default is None
#[serde(skip_serializing_if = "Option::is_none")]
pub additional_embedding_url: Option<String>,
/// The scale of the additional LORA model to use for the upscaling. Default is 1.0
#[serde(skip_serializing_if = "Option::is_none")]
pub additional_lora_scale: Option<f64>,
/// The URL to the additional LORA model to use for the upscaling. Default is None
#[serde(skip_serializing_if = "Option::is_none")]
pub additional_lora_url: Option<String>,
/// The URL to the base model to use for the upscaling
#[serde(skip_serializing_if = "Option::is_none")]
pub base_model_url: Option<String>,
/// How much the output can deviate from the original
#[serde(skip_serializing_if = "Option::is_none")]
pub creativity: Option<f64>,
/// How much detail to add
#[serde(skip_serializing_if = "Option::is_none")]
pub detail: Option<f64>,
/// If set to true, the resulting image will be checked whether it includes any
/// potentially unsafe content. If it does, it will be replaced with a black
/// image.
#[serde(skip_serializing_if = "Option::is_none")]
pub enable_safety_checks: Option<bool>,
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want
/// the model to stick to your prompt when looking for a related image to show you.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance_scale: Option<f64>,
/// The image to upscale.
/// "https://storage.googleapis.com/falserverless/model_tests/upscale/owl.png"
/// "https://storage.googleapis.com/falserverless/gallery/blue-bird.jpeg"
pub image_url: String,
/// The type of model to use for the upscaling. Default is SD_1_5
/// "SD_1_5"
/// "SDXL"
#[serde(skip_serializing_if = "Option::is_none")]
pub model_type: Option<String>,
/// The negative prompt to use.Use it to address details that you don't want
/// in the image. This could be colors, objects, scenery and even the small details
/// (e.g. moustache, blurry, low resolution).
/// "blurry, low resolution, bad, ugly, low quality, pixelated, interpolated, compression artifacts, noisey, grainy"
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// The number of inference steps to use for generating the image. The more steps
/// the better the image will be but it will also take longer to generate.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// Allow for large uploads that could take a very long time.
#[serde(skip_serializing_if = "Option::is_none")]
pub override_size_limits: Option<bool>,
/// The prompt to use for generating the image. Be as descriptive as possible for best results. If no prompt is provide BLIP2 will be used to generate a prompt.
#[serde(skip_serializing_if = "Option::is_none")]
pub prompt: Option<String>,
/// The suffix to add to the prompt. This is useful to add a common ending to all prompts such as 'high quality' etc or embedding tokens.
#[serde(skip_serializing_if = "Option::is_none")]
pub prompt_suffix: Option<String>,
/// The scale of the output image. The higher the scale, the bigger the output image will be.
#[serde(skip_serializing_if = "Option::is_none")]
pub scale: Option<f64>,
/// The same seed and the same prompt given to the same version of Stable Diffusion
/// will output the same image every time.
/// 42
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// How much to preserve the shape of the original image
#[serde(skip_serializing_if = "Option::is_none")]
pub shape_preservation: Option<f64>,
/// If set to true, the image will not be processed by the CCSR model before
/// being processed by the creativity model.
#[serde(skip_serializing_if = "Option::is_none")]
pub skip_ccsr: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct CreativeUpscalerOutput {
/// The generated image file info.
pub image: Image,
/// Seed of the generated Image. It will be the same value of the one passed in the
/// input or the randomly generated that was used in case none was passed.
pub seed: i64,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct HTTPValidationError {
#[serde(skip_serializing_if = "Option::is_none")]
pub detail: Option<Vec<Option<ValidationError>>>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Image {
/// The mime type of the file.
/// "image/png"
#[serde(skip_serializing_if = "Option::is_none")]
pub content_type: Option<String>,
/// File data
#[serde(skip_serializing_if = "Option::is_none")]
pub file_data: Option<String>,
/// The name of the file. It will be auto-generated if not provided.
/// "z9RV14K95DvU.png"
#[serde(skip_serializing_if = "Option::is_none")]
pub file_name: Option<String>,
/// The size of the file in bytes.
/// 4404019
#[serde(skip_serializing_if = "Option::is_none")]
pub file_size: Option<i64>,
/// The height of the image in pixels.
/// 1024
#[serde(skip_serializing_if = "Option::is_none")]
pub height: Option<i64>,
/// The URL where the file can be downloaded from.
pub url: String,
/// The width of the image in pixels.
/// 1024
#[serde(skip_serializing_if = "Option::is_none")]
pub width: Option<i64>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ValidationError {
pub loc: Vec<serde_json::Value>,
pub msg: String,
#[serde(rename = "type")]
pub ty: String,
}
/// Creative Upscaler
///
/// Category: image-to-image
/// Machine Type: A100
pub fn creative_upscaler(
params: CreativeUpscalerInput,
) -> FalRequest<CreativeUpscalerInput, CreativeUpscalerOutput> {
FalRequest::new("fal-ai/creative-upscaler", params)
}
+88
View File
@@ -0,0 +1,88 @@
#[allow(unused_imports)]
use crate::prelude::*;
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::collections::HashMap;
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct File {
/// The mime type of the file.
/// "image/png"
#[serde(skip_serializing_if = "Option::is_none")]
pub content_type: Option<String>,
/// File data
#[serde(skip_serializing_if = "Option::is_none")]
pub file_data: Option<String>,
/// The name of the file. It will be auto-generated if not provided.
/// "z9RV14K95DvU.png"
#[serde(skip_serializing_if = "Option::is_none")]
pub file_name: Option<String>,
/// The size of the file in bytes.
/// 4404019
#[serde(skip_serializing_if = "Option::is_none")]
pub file_size: Option<i64>,
/// The URL where the file can be downloaded from.
pub url: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct HTTPValidationError {
#[serde(skip_serializing_if = "Option::is_none")]
pub detail: Option<Vec<Option<ValidationError>>>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Input {
/// The context to generate an audio from.
/// [{"audio_url":"https://huggingface.co/spaces/sesame/csm-1b/resolve/main/prompts/conversational_a.wav","prompt":"like revising for an exam I'd have to try and like keep up the momentum because I'd start really early I'd be like okay I'm gonna start revising now and then like you're revising for ages and then I just like start losing steam I didn't do that for the exam we had recently to be fair that was a more of a last minute scenario but like yeah I'm trying to like yeah I noticed this yesterday that like Mondays I sort of start the day with this not like a panic but like a","speaker_id":0},{"audio_url":"https://huggingface.co/spaces/sesame/csm-1b/resolve/main/prompts/conversational_b.wav","prompt":"like a super Mario level. Like it's very like high detail. And like, once you get into the park, it just like, everything looks like a computer game and they have all these, like, you know, if, if there's like a, you know, like in a Mario game, they will have like a question block. And if you like, you know, punch it, a coin will come out. So like everyone, when they come into the park, they get like this little bracelet and then you can go punching question blocks around.","speaker_id":1}]
#[serde(skip_serializing_if = "Option::is_none")]
pub context: Option<Vec<Option<Speaker>>>,
/// The text to generate an audio from.
/// [{"speaker_id":0,"text":"Hey how are you doing."},{"speaker_id":1,"text":"Pretty good, pretty good."},{"speaker_id":0,"text":"I'm great, so happy to be speaking to you."}]
pub scene: Vec<Turn>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct Output {
/// The generated audio.
pub audio: AudioProperty,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Speaker {
pub audio_url: String,
pub prompt: String,
pub speaker_id: i64,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Turn {
pub speaker_id: i64,
pub text: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ValidationError {
pub loc: Vec<serde_json::Value>,
pub msg: String,
#[serde(rename = "type")]
pub ty: String,
}
#[derive(Debug, Serialize, Deserialize, smart_default::SmartDefault)]
#[allow(non_camel_case_types)]
pub enum AudioProperty {
#[default]
File(File),
String(String),
}
/// CSM-1B
///
/// Category: text-to-audio
/// Machine Type: H100
/// License Type: research
pub fn csm_1b(params: Input) -> FalRequest<Input, Output> {
FalRequest::new("fal-ai/csm-1b", params)
}
@@ -0,0 +1,74 @@
#[allow(unused_imports)]
use crate::prelude::*;
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::collections::HashMap;
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct DDColorInput {
/// URL of image to be used for relighting
/// "https://storage.googleapis.com/falserverless/gallery/Screenshot%202025-02-26%20154226.png"
pub image_url: String,
/// seed to be used for generation
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct DDColorOutput {
/// The generated image file info.
/// {"content_type":"image/png","file_name":"36d3ca4791a647678b2ff01a35c87f5a.png","file_size":423052,"height":512,"url":"https://storage.googleapis.com/falserverless/gallery/5fcaaac6d1344d998ebb9703102c6c63.png","width":512}
pub image: Image,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct HTTPValidationError {
#[serde(skip_serializing_if = "Option::is_none")]
pub detail: Option<Vec<Option<ValidationError>>>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Image {
/// The mime type of the file.
/// "image/png"
#[serde(skip_serializing_if = "Option::is_none")]
pub content_type: Option<String>,
/// File data
#[serde(skip_serializing_if = "Option::is_none")]
pub file_data: Option<String>,
/// The name of the file. It will be auto-generated if not provided.
/// "z9RV14K95DvU.png"
#[serde(skip_serializing_if = "Option::is_none")]
pub file_name: Option<String>,
/// The size of the file in bytes.
/// 4404019
#[serde(skip_serializing_if = "Option::is_none")]
pub file_size: Option<i64>,
/// The height of the image in pixels.
/// 1024
#[serde(skip_serializing_if = "Option::is_none")]
pub height: Option<i64>,
/// The URL where the file can be downloaded from.
pub url: String,
/// The width of the image in pixels.
/// 1024
#[serde(skip_serializing_if = "Option::is_none")]
pub width: Option<i64>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ValidationError {
pub loc: Vec<serde_json::Value>,
pub msg: String,
#[serde(rename = "type")]
pub ty: String,
}
/// DDColor
///
/// Category: image-to-image
/// Machine Type: A100
pub fn ddcolor(params: DDColorInput) -> FalRequest<DDColorInput, DDColorOutput> {
FalRequest::new("fal-ai/ddcolor", params)
}
@@ -0,0 +1,84 @@
#[allow(unused_imports)]
use crate::prelude::*;
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::collections::HashMap;
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct File {
/// The mime type of the file.
/// "image/png"
#[serde(skip_serializing_if = "Option::is_none")]
pub content_type: Option<String>,
/// File data
#[serde(skip_serializing_if = "Option::is_none")]
pub file_data: Option<String>,
/// The name of the file. It will be auto-generated if not provided.
/// "z9RV14K95DvU.png"
#[serde(skip_serializing_if = "Option::is_none")]
pub file_name: Option<String>,
/// The size of the file in bytes.
/// 4404019
#[serde(skip_serializing_if = "Option::is_none")]
pub file_size: Option<i64>,
/// The URL where the file can be downloaded from.
pub url: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct HTTPValidationError {
#[serde(skip_serializing_if = "Option::is_none")]
pub detail: Option<Vec<Option<ValidationError>>>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct Output {
/// Generated music file.
/// {"content_type":"application/octet-stream","file_name":"output.wav","file_size":33554520,"url":"https://v3.fal.media/files/elephant/VV4wtKXBpZL1bNv6en36t_output.wav"}
pub audio: File,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct TextToMusicInput {
/// The CFG strength to use for the music generation.
#[serde(skip_serializing_if = "Option::is_none")]
pub cfg_strength: Option<f64>,
/// The prompt to generate the song from. Must have two sections. Sections start with either [chorus] or a [verse].
/// "[00:10.00]Moonlight spills through broken blinds\n[00:13.20]Your shadow dances on the dashboard shrine\n[00:16.85]Neon ghosts in gasoline rain\n[00:20.40]I hear your laughter down the midnight train\n[00:24.15]Static whispers through frayed wires\n[00:27.65]Guitar strings hum our cathedral choirs\n[00:31.30]Flicker screens show reruns of June\n[00:34.90]I'm drowning in this mercury lagoon\n[00:38.55]Electric veins pulse through concrete skies\n[00:42.10]Your name echoes in the hollow where my heartbeat lies\n[00:45.75]We're satellites trapped in parallel light\n[00:49.25]Burning through the atmosphere of endless night\n[01:00.00]Dusty vinyl spins reverse\n[01:03.45]Our polaroid timeline bleeds through the verse\n[01:07.10]Telescope aimed at dead stars\n[01:10.65]Still tracing constellations through prison bars\n[01:14.30]Electric veins pulse through concrete skies\n[01:17.85]Your name echoes in the hollow where my heartbeat lies\n[01:21.50]We're satellites trapped in parallel light\n[01:25.05]Burning through the atmosphere of endless night\n[02:10.00]Clockwork gears grind moonbeams to rust\n[02:13.50]Our fingerprint smudged by interstellar dust\n[02:17.15]Velvet thunder rolls through my veins\n[02:20.70]Chasing phantom trains through solar plane\n[02:24.35]Electric veins pulse through concrete skies\n[02:27.90]Your name echoes in the hollow where my heartbeat lies\n"
pub lyrics: String,
/// The duration of the music to generate.
#[serde(skip_serializing_if = "Option::is_none")]
pub music_duration: Option<String>,
/// The number of inference steps to use for the music generation.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// The URL of the reference audio to use for the music generation.
/// "https://storage.googleapis.com/falserverless/model_tests/diffrythm/rock_en.wav"
#[serde(skip_serializing_if = "Option::is_none")]
pub reference_audio_url: Option<String>,
/// The scheduler to use for the music generation.
#[serde(skip_serializing_if = "Option::is_none")]
pub scheduler: Option<String>,
/// The style prompt to use for the music generation.
/// "pop"
#[serde(skip_serializing_if = "Option::is_none")]
pub style_prompt: Option<String>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ValidationError {
pub loc: Vec<serde_json::Value>,
pub msg: String,
#[serde(rename = "type")]
pub ty: String,
}
/// DiffRhythm: Lyrics to Song
///
/// Category: text-to-audio
///
/// License Type: commercial
pub fn diffrhythm(params: TextToMusicInput) -> FalRequest<TextToMusicInput, Output> {
FalRequest::new("fal-ai/diffrhythm", params)
}
@@ -0,0 +1,67 @@
#[allow(unused_imports)]
use crate::prelude::*;
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::collections::HashMap;
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct DiffusionEdgeInput {
/// The text prompt you would like to convert to speech.
/// "https://storage.googleapis.com/falserverless/model_tests/upscale/hamburger.png"
pub image_url: String,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct DiffusionEdgeOutput {
/// The generated image file info.
pub image: Image,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct HTTPValidationError {
#[serde(skip_serializing_if = "Option::is_none")]
pub detail: Option<Vec<Option<ValidationError>>>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Image {
/// The mime type of the file.
/// "image/png"
pub content_type: String,
/// The name of the file. It will be auto-generated if not provided.
/// "z9RV14K95DvU.png"
pub file_name: String,
/// The size of the file in bytes.
/// 4404019
pub file_size: i64,
/// The height of the image in pixels.
/// 1024
#[serde(skip_serializing_if = "Option::is_none")]
pub height: Option<i64>,
/// The URL where the file can be downloaded from.
/// "https://url.to/generated/file/z9RV14K95DvU.png"
pub url: String,
/// The width of the image in pixels.
/// 1024
#[serde(skip_serializing_if = "Option::is_none")]
pub width: Option<i64>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ValidationError {
pub loc: Vec<serde_json::Value>,
pub msg: String,
#[serde(rename = "type")]
pub ty: String,
}
/// DiffusionEdge
///
/// Category: text-to-image
/// Machine Type: A6000
pub fn diffusion_edge(
params: DiffusionEdgeInput,
) -> FalRequest<DiffusionEdgeInput, DiffusionEdgeOutput> {
FalRequest::new("fal-ai/diffusion-edge", params)
}
@@ -0,0 +1,88 @@
#[allow(unused_imports)]
use crate::prelude::*;
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::collections::HashMap;
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct DocResInput {
/// URL of image to be used for relighting
/// "https://storage.googleapis.com/falserverless/docres_ckpt/218_in.png"
pub image_url: String,
/// The same seed and the same prompt given to the same version of the model
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// Task to perform
pub task: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct DocResInputDewarp {
/// URL of image to be used for relighting
/// "https://storage.googleapis.com/falserverless/docres_ckpt/218_in.png"
pub image_url: String,
/// The same seed and the same prompt given to the same version of the model
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct DocResOutput {
/// The generated image file info.
/// {"content_type":"image/png","file_name":"36d3ca4791a647678b2ff01a35c87f5a.png","file_size":423052,"height":512,"url":"https://storage.googleapis.com/falserverless/docres_ckpt/Xssvg5K39QiD6mn9K5toF_f4942abeef8d4c7bbe236b59aed5e382.png","width":512}
pub image: Image,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct HTTPValidationError {
#[serde(skip_serializing_if = "Option::is_none")]
pub detail: Option<Vec<Option<ValidationError>>>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Image {
/// The mime type of the file.
/// "image/png"
#[serde(skip_serializing_if = "Option::is_none")]
pub content_type: Option<String>,
/// File data
#[serde(skip_serializing_if = "Option::is_none")]
pub file_data: Option<String>,
/// The name of the file. It will be auto-generated if not provided.
/// "z9RV14K95DvU.png"
#[serde(skip_serializing_if = "Option::is_none")]
pub file_name: Option<String>,
/// The size of the file in bytes.
/// 4404019
#[serde(skip_serializing_if = "Option::is_none")]
pub file_size: Option<i64>,
/// The height of the image in pixels.
/// 1024
#[serde(skip_serializing_if = "Option::is_none")]
pub height: Option<i64>,
/// The URL where the file can be downloaded from.
pub url: String,
/// The width of the image in pixels.
/// 1024
#[serde(skip_serializing_if = "Option::is_none")]
pub width: Option<i64>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ValidationError {
pub loc: Vec<serde_json::Value>,
pub msg: String,
#[serde(rename = "type")]
pub ty: String,
}
/// DocRes
///
/// Category: image-to-image
/// Machine Type: A100
pub fn dewarp(params: DocResInputDewarp) -> FalRequest<DocResInputDewarp, DocResOutput> {
FalRequest::new("fal-ai/docres/dewarp", params)
}
+103
View File
@@ -0,0 +1,103 @@
#[allow(unused_imports)]
use crate::prelude::*;
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::collections::HashMap;
#[cfg(any(
feature = "endpoints",
feature = "endpoints_fal-ai",
feature = "endpoints_fal-ai_docres"
))]
#[cfg_attr(
docsrs,
doc(cfg(any(
feature = "endpoints",
feature = "endpoints_fal-ai",
feature = "endpoints_fal-ai_docres"
)))
)]
pub mod dewarp;
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct DocResInput {
/// URL of image to be used for relighting
/// "https://storage.googleapis.com/falserverless/docres_ckpt/218_in.png"
pub image_url: String,
/// The same seed and the same prompt given to the same version of the model
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// Task to perform
pub task: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct DocResInputDewarp {
/// URL of image to be used for relighting
/// "https://storage.googleapis.com/falserverless/docres_ckpt/218_in.png"
pub image_url: String,
/// The same seed and the same prompt given to the same version of the model
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct DocResOutput {
/// The generated image file info.
/// {"content_type":"image/png","file_name":"36d3ca4791a647678b2ff01a35c87f5a.png","file_size":423052,"height":512,"url":"https://storage.googleapis.com/falserverless/docres_ckpt/Xssvg5K39QiD6mn9K5toF_f4942abeef8d4c7bbe236b59aed5e382.png","width":512}
pub image: Image,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct HTTPValidationError {
#[serde(skip_serializing_if = "Option::is_none")]
pub detail: Option<Vec<Option<ValidationError>>>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Image {
/// The mime type of the file.
/// "image/png"
#[serde(skip_serializing_if = "Option::is_none")]
pub content_type: Option<String>,
/// File data
#[serde(skip_serializing_if = "Option::is_none")]
pub file_data: Option<String>,
/// The name of the file. It will be auto-generated if not provided.
/// "z9RV14K95DvU.png"
#[serde(skip_serializing_if = "Option::is_none")]
pub file_name: Option<String>,
/// The size of the file in bytes.
/// 4404019
#[serde(skip_serializing_if = "Option::is_none")]
pub file_size: Option<i64>,
/// The height of the image in pixels.
/// 1024
#[serde(skip_serializing_if = "Option::is_none")]
pub height: Option<i64>,
/// The URL where the file can be downloaded from.
pub url: String,
/// The width of the image in pixels.
/// 1024
#[serde(skip_serializing_if = "Option::is_none")]
pub width: Option<i64>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ValidationError {
pub loc: Vec<serde_json::Value>,
pub msg: String,
#[serde(rename = "type")]
pub ty: String,
}
/// DocRes
///
/// Category: image-to-image
/// Machine Type: A100
pub fn docres(params: DocResInput) -> FalRequest<DocResInput, DocResOutput> {
FalRequest::new("fal-ai/docres", params)
}
@@ -0,0 +1,76 @@
#[allow(unused_imports)]
use crate::prelude::*;
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::collections::HashMap;
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct HTTPValidationError {
#[serde(skip_serializing_if = "Option::is_none")]
pub detail: Option<Vec<Option<ValidationError>>>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Image {
/// The mime type of the file.
/// "image/png"
#[serde(skip_serializing_if = "Option::is_none")]
pub content_type: Option<String>,
/// File data
#[serde(skip_serializing_if = "Option::is_none")]
pub file_data: Option<String>,
/// The name of the file. It will be auto-generated if not provided.
/// "z9RV14K95DvU.png"
#[serde(skip_serializing_if = "Option::is_none")]
pub file_name: Option<String>,
/// The size of the file in bytes.
/// 4404019
#[serde(skip_serializing_if = "Option::is_none")]
pub file_size: Option<i64>,
/// The height of the image in pixels.
/// 1024
#[serde(skip_serializing_if = "Option::is_none")]
pub height: Option<i64>,
/// The URL where the file can be downloaded from.
pub url: String,
/// The width of the image in pixels.
/// 1024
#[serde(skip_serializing_if = "Option::is_none")]
pub width: Option<i64>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Input {
/// URL of the image to upscale.
/// "https://fal.media/files/rabbit/JlBgYUyQRS3zxiBu_B4fM.png"
/// "https://fal.media/files/monkey/e6RtJf_ue0vyWzeiEmTby.png"
/// "https://fal.media/files/monkey/A6HGsigx4mmvs-hJVoOZX.png"
pub image_url: String,
/// Upscaling factor.
/// 4
#[serde(skip_serializing_if = "Option::is_none")]
pub upscaling_factor: Option<i64>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct Output {
/// Upscaled image
pub image: Image,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ValidationError {
pub loc: Vec<serde_json::Value>,
pub msg: String,
#[serde(rename = "type")]
pub ty: String,
}
/// DRCT-Super-Resolution
///
/// Category: image-to-image
/// Machine Type: A100
pub fn drct_super_resolution(params: Input) -> FalRequest<Input, Output> {
FalRequest::new("fal-ai/drct-super-resolution", params)
}
@@ -0,0 +1,300 @@
#[allow(unused_imports)]
use crate::prelude::*;
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::collections::HashMap;
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct DreamshaperImageToImageInput {
/// The list of embeddings to use.
#[serde(skip_serializing_if = "Option::is_none")]
pub embeddings: Option<Vec<Option<Embedding>>>,
/// If set to true, the safety checker will be enabled.
#[serde(skip_serializing_if = "Option::is_none")]
pub enable_safety_checker: Option<bool>,
/// If set to true, the prompt will be expanded with additional prompts.
#[serde(skip_serializing_if = "Option::is_none")]
pub expand_prompt: Option<bool>,
/// The format of the generated image.
#[serde(skip_serializing_if = "Option::is_none")]
pub format: Option<String>,
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want
/// the model to stick to your prompt when looking for a related image to show you.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance_scale: Option<f64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub image_size: Option<ImageSizeProperty>,
/// The URL of the image to use as a starting point for the generation.
/// "https://fal-cdn.batuhan-941.workers.dev/files/tiger/IExuP-WICqaIesLZAZPur.jpeg"
pub image_url: String,
/// The list of LoRA weights to use.
#[serde(skip_serializing_if = "Option::is_none")]
pub loras: Option<Vec<Option<LoraWeight>>>,
/// The Dreamshaper model to use.
/// "Lykon/dreamshaper-8"
/// "Lykon/dreamshaper-xl-1-0"
/// "Lykon/dreamshaper-xl-v2-turbo"
#[serde(skip_serializing_if = "Option::is_none")]
pub model_name: Option<String>,
/// The negative prompt to use.Use it to address details that you don't want
/// in the image. This could be colors, objects, scenery and even the small details
/// (e.g. moustache, blurry, low resolution).
/// "cartoon, illustration, animation. face. male, female"
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// The number of images to generate.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_images: Option<i64>,
/// The number of inference steps to perform.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// The prompt to use for generating the image. Be as descriptive as possible for best results.
/// "an island near sea, with seagulls, moon shining over the sea, light house, boats int he background, fish flying over the sea"
pub prompt: String,
/// The version of the safety checker to use. v1 is the default CompVis safety checker. v2 uses a custom ViT model.
#[serde(skip_serializing_if = "Option::is_none")]
pub safety_checker_version: Option<String>,
/// The same seed and the same prompt given to the same version of Stable Diffusion
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// determines how much the generated image resembles the initial image
#[serde(skip_serializing_if = "Option::is_none")]
pub strength: Option<f64>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct DreamshaperInpaintingInput {
/// The list of embeddings to use.
#[serde(skip_serializing_if = "Option::is_none")]
pub embeddings: Option<Vec<Option<Embedding>>>,
/// If set to true, the safety checker will be enabled.
#[serde(skip_serializing_if = "Option::is_none")]
pub enable_safety_checker: Option<bool>,
/// If set to true, the prompt will be expanded with additional prompts.
#[serde(skip_serializing_if = "Option::is_none")]
pub expand_prompt: Option<bool>,
/// The format of the generated image.
#[serde(skip_serializing_if = "Option::is_none")]
pub format: Option<String>,
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want
/// the model to stick to your prompt when looking for a related image to show you.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance_scale: Option<f64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub image_size: Option<ImageSizeProperty>,
/// The URL of the image to use as a starting point for the generation.
/// "https://raw.githubusercontent.com/CompVis/latent-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo.png"
pub image_url: String,
/// The list of LoRA weights to use.
#[serde(skip_serializing_if = "Option::is_none")]
pub loras: Option<Vec<Option<LoraWeight>>>,
/// The URL of the mask to use for inpainting.
/// "https://raw.githubusercontent.com/CompVis/latent-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo_mask.png"
pub mask_url: String,
/// The Dreamshaper model to use.
/// "Lykon/dreamshaper-8"
/// "Lykon/dreamshaper-xl-1-0"
/// "Lykon/dreamshaper-xl-v2-turbo"
#[serde(skip_serializing_if = "Option::is_none")]
pub model_name: Option<String>,
/// The negative prompt to use.Use it to address details that you don't want
/// in the image. This could be colors, objects, scenery and even the small details
/// (e.g. moustache, blurry, low resolution).
/// "cartoon, illustration, animation. face. male, female"
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// The number of images to generate.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_images: Option<i64>,
/// The number of inference steps to perform.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// The prompt to use for generating the image. Be as descriptive as possible for best results.
/// "a tiger sitting on a park bench"
pub prompt: String,
/// The version of the safety checker to use. v1 is the default CompVis safety checker. v2 uses a custom ViT model.
#[serde(skip_serializing_if = "Option::is_none")]
pub safety_checker_version: Option<String>,
/// The same seed and the same prompt given to the same version of Stable Diffusion
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// determines how much the generated image resembles the initial image
#[serde(skip_serializing_if = "Option::is_none")]
pub strength: Option<f64>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct DreamshaperTextToImageInput {
/// The list of embeddings to use.
#[serde(skip_serializing_if = "Option::is_none")]
pub embeddings: Option<Vec<Option<Embedding>>>,
/// If set to true, the safety checker will be enabled.
#[serde(skip_serializing_if = "Option::is_none")]
pub enable_safety_checker: Option<bool>,
/// If set to true, the prompt will be expanded with additional prompts.
#[serde(skip_serializing_if = "Option::is_none")]
pub expand_prompt: Option<bool>,
/// The format of the generated image.
#[serde(skip_serializing_if = "Option::is_none")]
pub format: Option<String>,
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want the model to stick to your prompt when looking for a related image to show you.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance_scale: Option<f64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub image_size: Option<ImageSizeProperty>,
/// The list of LoRA weights to use.
#[serde(skip_serializing_if = "Option::is_none")]
pub loras: Option<Vec<Option<LoraWeight>>>,
/// The Dreamshaper model to use.
/// "Lykon/dreamshaper-8"
/// "Lykon/dreamshaper-xl-1-0"
/// "Lykon/dreamshaper-xl-v2-turbo"
#[serde(skip_serializing_if = "Option::is_none")]
pub model_name: Option<String>,
/// The negative prompt to use. Use it to address details that you don't want in the image.
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// The number of images to generate.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_images: Option<i64>,
/// The number of inference steps to perform.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// The prompt to use for generating the image. Be as descriptive as possible for best results.
/// "A hyperdetailed photograph of a Cat dressed as a mafia boss holding a fish walking down a Japanese fish market with an angry face, 8k resolution, best quality, beautiful photograph, dynamic lighting,"
pub prompt: String,
/// The version of the safety checker to use. v1 is the default CompVis safety checker. v2 uses a custom ViT model.
#[serde(skip_serializing_if = "Option::is_none")]
pub safety_checker_version: Option<String>,
/// The same seed and the same prompt given to the same version of Stable Diffusion
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Embedding {
/// URL or the path to the embedding weights.
/// "https://civitai.com/api/download/models/135931"
/// "https://filebin.net/3chfqasxpqu21y8n/my-custom-lora-v1.safetensors"
pub path: String,
/// The list of tokens to use for the embedding.
#[serde(skip_serializing_if = "Option::is_none")]
pub tokens: Option<Vec<Option<String>>>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct HTTPValidationError {
#[serde(skip_serializing_if = "Option::is_none")]
pub detail: Option<Vec<Option<ValidationError>>>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Image {
#[serde(skip_serializing_if = "Option::is_none")]
pub content_type: Option<String>,
pub height: i64,
pub url: String,
pub width: i64,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ImageSize {
/// The height of the generated image.
#[serde(skip_serializing_if = "Option::is_none")]
pub height: Option<i64>,
/// The width of the generated image.
#[serde(skip_serializing_if = "Option::is_none")]
pub width: Option<i64>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct LoraWeight {
/// If set to true, the embedding will be forced to be used.
#[serde(skip_serializing_if = "Option::is_none")]
pub force: Option<bool>,
/// URL or the path to the LoRA weights. Or HF model name.
/// "https://civitai.com/api/download/models/135931"
/// "https://filebin.net/3chfqasxpqu21y8n/my-custom-lora-v1.safetensors"
pub path: String,
/// The scale of the LoRA weight. This is used to scale the LoRA weight
/// before merging it with the base model.
#[serde(skip_serializing_if = "Option::is_none")]
pub scale: Option<f64>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct Output {
/// Whether the generated images contain NSFW concepts.
pub has_nsfw_concepts: Vec<bool>,
/// The generated image files info.
pub images: Vec<Image>,
/// The prompt used for generating the image.
pub prompt: String,
/// Seed of the generated Image. It will be the same value of the one passed in the
/// input or the randomly generated that was used in case none was passed.
pub seed: i64,
pub timings: Timings,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ValidationError {
pub loc: Vec<serde_json::Value>,
pub msg: String,
#[serde(rename = "type")]
pub ty: String,
}
#[derive(Debug, Serialize, Deserialize, smart_default::SmartDefault)]
#[allow(non_camel_case_types)]
pub enum ImageSizeProperty {
#[default]
ImageSize(ImageSize),
#[serde(rename = "square_hd")]
SquareHd,
#[serde(rename = "square")]
Square,
#[serde(rename = "portrait_4_3")]
Portrait43,
#[serde(rename = "portrait_16_9")]
Portrait169,
#[serde(rename = "landscape_4_3")]
Landscape43,
#[serde(rename = "landscape_16_9")]
Landscape169,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Timings {
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(rename = "type")]
pub ty: Option<serde_json::Value>,
}
/// Dreamshaper
///
/// Category: text-to-image
/// Machine Type: A100
pub fn image_to_image(
params: DreamshaperImageToImageInput,
) -> FalRequest<DreamshaperImageToImageInput, Output> {
FalRequest::new("fal-ai/dreamshaper/image-to-image", params)
}
@@ -0,0 +1,300 @@
#[allow(unused_imports)]
use crate::prelude::*;
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::collections::HashMap;
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct DreamshaperImageToImageInput {
/// The list of embeddings to use.
#[serde(skip_serializing_if = "Option::is_none")]
pub embeddings: Option<Vec<Option<Embedding>>>,
/// If set to true, the safety checker will be enabled.
#[serde(skip_serializing_if = "Option::is_none")]
pub enable_safety_checker: Option<bool>,
/// If set to true, the prompt will be expanded with additional prompts.
#[serde(skip_serializing_if = "Option::is_none")]
pub expand_prompt: Option<bool>,
/// The format of the generated image.
#[serde(skip_serializing_if = "Option::is_none")]
pub format: Option<String>,
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want
/// the model to stick to your prompt when looking for a related image to show you.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance_scale: Option<f64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub image_size: Option<ImageSizeProperty>,
/// The URL of the image to use as a starting point for the generation.
/// "https://fal-cdn.batuhan-941.workers.dev/files/tiger/IExuP-WICqaIesLZAZPur.jpeg"
pub image_url: String,
/// The list of LoRA weights to use.
#[serde(skip_serializing_if = "Option::is_none")]
pub loras: Option<Vec<Option<LoraWeight>>>,
/// The Dreamshaper model to use.
/// "Lykon/dreamshaper-8"
/// "Lykon/dreamshaper-xl-1-0"
/// "Lykon/dreamshaper-xl-v2-turbo"
#[serde(skip_serializing_if = "Option::is_none")]
pub model_name: Option<String>,
/// The negative prompt to use.Use it to address details that you don't want
/// in the image. This could be colors, objects, scenery and even the small details
/// (e.g. moustache, blurry, low resolution).
/// "cartoon, illustration, animation. face. male, female"
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// The number of images to generate.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_images: Option<i64>,
/// The number of inference steps to perform.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// The prompt to use for generating the image. Be as descriptive as possible for best results.
/// "an island near sea, with seagulls, moon shining over the sea, light house, boats int he background, fish flying over the sea"
pub prompt: String,
/// The version of the safety checker to use. v1 is the default CompVis safety checker. v2 uses a custom ViT model.
#[serde(skip_serializing_if = "Option::is_none")]
pub safety_checker_version: Option<String>,
/// The same seed and the same prompt given to the same version of Stable Diffusion
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// determines how much the generated image resembles the initial image
#[serde(skip_serializing_if = "Option::is_none")]
pub strength: Option<f64>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct DreamshaperInpaintingInput {
/// The list of embeddings to use.
#[serde(skip_serializing_if = "Option::is_none")]
pub embeddings: Option<Vec<Option<Embedding>>>,
/// If set to true, the safety checker will be enabled.
#[serde(skip_serializing_if = "Option::is_none")]
pub enable_safety_checker: Option<bool>,
/// If set to true, the prompt will be expanded with additional prompts.
#[serde(skip_serializing_if = "Option::is_none")]
pub expand_prompt: Option<bool>,
/// The format of the generated image.
#[serde(skip_serializing_if = "Option::is_none")]
pub format: Option<String>,
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want
/// the model to stick to your prompt when looking for a related image to show you.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance_scale: Option<f64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub image_size: Option<ImageSizeProperty>,
/// The URL of the image to use as a starting point for the generation.
/// "https://raw.githubusercontent.com/CompVis/latent-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo.png"
pub image_url: String,
/// The list of LoRA weights to use.
#[serde(skip_serializing_if = "Option::is_none")]
pub loras: Option<Vec<Option<LoraWeight>>>,
/// The URL of the mask to use for inpainting.
/// "https://raw.githubusercontent.com/CompVis/latent-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo_mask.png"
pub mask_url: String,
/// The Dreamshaper model to use.
/// "Lykon/dreamshaper-8"
/// "Lykon/dreamshaper-xl-1-0"
/// "Lykon/dreamshaper-xl-v2-turbo"
#[serde(skip_serializing_if = "Option::is_none")]
pub model_name: Option<String>,
/// The negative prompt to use.Use it to address details that you don't want
/// in the image. This could be colors, objects, scenery and even the small details
/// (e.g. moustache, blurry, low resolution).
/// "cartoon, illustration, animation. face. male, female"
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// The number of images to generate.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_images: Option<i64>,
/// The number of inference steps to perform.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// The prompt to use for generating the image. Be as descriptive as possible for best results.
/// "a tiger sitting on a park bench"
pub prompt: String,
/// The version of the safety checker to use. v1 is the default CompVis safety checker. v2 uses a custom ViT model.
#[serde(skip_serializing_if = "Option::is_none")]
pub safety_checker_version: Option<String>,
/// The same seed and the same prompt given to the same version of Stable Diffusion
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// determines how much the generated image resembles the initial image
#[serde(skip_serializing_if = "Option::is_none")]
pub strength: Option<f64>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct DreamshaperTextToImageInput {
/// The list of embeddings to use.
#[serde(skip_serializing_if = "Option::is_none")]
pub embeddings: Option<Vec<Option<Embedding>>>,
/// If set to true, the safety checker will be enabled.
#[serde(skip_serializing_if = "Option::is_none")]
pub enable_safety_checker: Option<bool>,
/// If set to true, the prompt will be expanded with additional prompts.
#[serde(skip_serializing_if = "Option::is_none")]
pub expand_prompt: Option<bool>,
/// The format of the generated image.
#[serde(skip_serializing_if = "Option::is_none")]
pub format: Option<String>,
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want the model to stick to your prompt when looking for a related image to show you.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance_scale: Option<f64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub image_size: Option<ImageSizeProperty>,
/// The list of LoRA weights to use.
#[serde(skip_serializing_if = "Option::is_none")]
pub loras: Option<Vec<Option<LoraWeight>>>,
/// The Dreamshaper model to use.
/// "Lykon/dreamshaper-8"
/// "Lykon/dreamshaper-xl-1-0"
/// "Lykon/dreamshaper-xl-v2-turbo"
#[serde(skip_serializing_if = "Option::is_none")]
pub model_name: Option<String>,
/// The negative prompt to use. Use it to address details that you don't want in the image.
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// The number of images to generate.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_images: Option<i64>,
/// The number of inference steps to perform.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// The prompt to use for generating the image. Be as descriptive as possible for best results.
/// "A hyperdetailed photograph of a Cat dressed as a mafia boss holding a fish walking down a Japanese fish market with an angry face, 8k resolution, best quality, beautiful photograph, dynamic lighting,"
pub prompt: String,
/// The version of the safety checker to use. v1 is the default CompVis safety checker. v2 uses a custom ViT model.
#[serde(skip_serializing_if = "Option::is_none")]
pub safety_checker_version: Option<String>,
/// The same seed and the same prompt given to the same version of Stable Diffusion
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Embedding {
/// URL or the path to the embedding weights.
/// "https://civitai.com/api/download/models/135931"
/// "https://filebin.net/3chfqasxpqu21y8n/my-custom-lora-v1.safetensors"
pub path: String,
/// The list of tokens to use for the embedding.
#[serde(skip_serializing_if = "Option::is_none")]
pub tokens: Option<Vec<Option<String>>>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct HTTPValidationError {
#[serde(skip_serializing_if = "Option::is_none")]
pub detail: Option<Vec<Option<ValidationError>>>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Image {
#[serde(skip_serializing_if = "Option::is_none")]
pub content_type: Option<String>,
pub height: i64,
pub url: String,
pub width: i64,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ImageSize {
/// The height of the generated image.
#[serde(skip_serializing_if = "Option::is_none")]
pub height: Option<i64>,
/// The width of the generated image.
#[serde(skip_serializing_if = "Option::is_none")]
pub width: Option<i64>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct LoraWeight {
/// If set to true, the embedding will be forced to be used.
#[serde(skip_serializing_if = "Option::is_none")]
pub force: Option<bool>,
/// URL or the path to the LoRA weights. Or HF model name.
/// "https://civitai.com/api/download/models/135931"
/// "https://filebin.net/3chfqasxpqu21y8n/my-custom-lora-v1.safetensors"
pub path: String,
/// The scale of the LoRA weight. This is used to scale the LoRA weight
/// before merging it with the base model.
#[serde(skip_serializing_if = "Option::is_none")]
pub scale: Option<f64>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct Output {
/// Whether the generated images contain NSFW concepts.
pub has_nsfw_concepts: Vec<bool>,
/// The generated image files info.
pub images: Vec<Image>,
/// The prompt used for generating the image.
pub prompt: String,
/// Seed of the generated Image. It will be the same value of the one passed in the
/// input or the randomly generated that was used in case none was passed.
pub seed: i64,
pub timings: Timings,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ValidationError {
pub loc: Vec<serde_json::Value>,
pub msg: String,
#[serde(rename = "type")]
pub ty: String,
}
#[derive(Debug, Serialize, Deserialize, smart_default::SmartDefault)]
#[allow(non_camel_case_types)]
pub enum ImageSizeProperty {
#[default]
ImageSize(ImageSize),
#[serde(rename = "square_hd")]
SquareHd,
#[serde(rename = "square")]
Square,
#[serde(rename = "portrait_4_3")]
Portrait43,
#[serde(rename = "portrait_16_9")]
Portrait169,
#[serde(rename = "landscape_4_3")]
Landscape43,
#[serde(rename = "landscape_16_9")]
Landscape169,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Timings {
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(rename = "type")]
pub ty: Option<serde_json::Value>,
}
/// Dreamshaper
///
/// Category: text-to-image
/// Machine Type: A100
pub fn inpainting(
params: DreamshaperInpaintingInput,
) -> FalRequest<DreamshaperInpaintingInput, Output> {
FalRequest::new("fal-ai/dreamshaper/inpainting", params)
}
@@ -0,0 +1,329 @@
#[allow(unused_imports)]
use crate::prelude::*;
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::collections::HashMap;
#[cfg(any(
feature = "endpoints",
feature = "endpoints_fal-ai",
feature = "endpoints_fal-ai_dreamshaper"
))]
#[cfg_attr(
docsrs,
doc(cfg(any(
feature = "endpoints",
feature = "endpoints_fal-ai",
feature = "endpoints_fal-ai_dreamshaper"
)))
)]
pub mod image_to_image;
#[cfg(any(
feature = "endpoints",
feature = "endpoints_fal-ai",
feature = "endpoints_fal-ai_dreamshaper"
))]
#[cfg_attr(
docsrs,
doc(cfg(any(
feature = "endpoints",
feature = "endpoints_fal-ai",
feature = "endpoints_fal-ai_dreamshaper"
)))
)]
pub mod inpainting;
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct DreamshaperImageToImageInput {
/// The list of embeddings to use.
#[serde(skip_serializing_if = "Option::is_none")]
pub embeddings: Option<Vec<Option<Embedding>>>,
/// If set to true, the safety checker will be enabled.
#[serde(skip_serializing_if = "Option::is_none")]
pub enable_safety_checker: Option<bool>,
/// If set to true, the prompt will be expanded with additional prompts.
#[serde(skip_serializing_if = "Option::is_none")]
pub expand_prompt: Option<bool>,
/// The format of the generated image.
#[serde(skip_serializing_if = "Option::is_none")]
pub format: Option<String>,
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want
/// the model to stick to your prompt when looking for a related image to show you.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance_scale: Option<f64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub image_size: Option<ImageSizeProperty>,
/// The URL of the image to use as a starting point for the generation.
/// "https://fal-cdn.batuhan-941.workers.dev/files/tiger/IExuP-WICqaIesLZAZPur.jpeg"
pub image_url: String,
/// The list of LoRA weights to use.
#[serde(skip_serializing_if = "Option::is_none")]
pub loras: Option<Vec<Option<LoraWeight>>>,
/// The Dreamshaper model to use.
/// "Lykon/dreamshaper-8"
/// "Lykon/dreamshaper-xl-1-0"
/// "Lykon/dreamshaper-xl-v2-turbo"
#[serde(skip_serializing_if = "Option::is_none")]
pub model_name: Option<String>,
/// The negative prompt to use.Use it to address details that you don't want
/// in the image. This could be colors, objects, scenery and even the small details
/// (e.g. moustache, blurry, low resolution).
/// "cartoon, illustration, animation. face. male, female"
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// The number of images to generate.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_images: Option<i64>,
/// The number of inference steps to perform.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// The prompt to use for generating the image. Be as descriptive as possible for best results.
/// "an island near sea, with seagulls, moon shining over the sea, light house, boats int he background, fish flying over the sea"
pub prompt: String,
/// The version of the safety checker to use. v1 is the default CompVis safety checker. v2 uses a custom ViT model.
#[serde(skip_serializing_if = "Option::is_none")]
pub safety_checker_version: Option<String>,
/// The same seed and the same prompt given to the same version of Stable Diffusion
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// determines how much the generated image resembles the initial image
#[serde(skip_serializing_if = "Option::is_none")]
pub strength: Option<f64>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct DreamshaperInpaintingInput {
/// The list of embeddings to use.
#[serde(skip_serializing_if = "Option::is_none")]
pub embeddings: Option<Vec<Option<Embedding>>>,
/// If set to true, the safety checker will be enabled.
#[serde(skip_serializing_if = "Option::is_none")]
pub enable_safety_checker: Option<bool>,
/// If set to true, the prompt will be expanded with additional prompts.
#[serde(skip_serializing_if = "Option::is_none")]
pub expand_prompt: Option<bool>,
/// The format of the generated image.
#[serde(skip_serializing_if = "Option::is_none")]
pub format: Option<String>,
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want
/// the model to stick to your prompt when looking for a related image to show you.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance_scale: Option<f64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub image_size: Option<ImageSizeProperty>,
/// The URL of the image to use as a starting point for the generation.
/// "https://raw.githubusercontent.com/CompVis/latent-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo.png"
pub image_url: String,
/// The list of LoRA weights to use.
#[serde(skip_serializing_if = "Option::is_none")]
pub loras: Option<Vec<Option<LoraWeight>>>,
/// The URL of the mask to use for inpainting.
/// "https://raw.githubusercontent.com/CompVis/latent-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo_mask.png"
pub mask_url: String,
/// The Dreamshaper model to use.
/// "Lykon/dreamshaper-8"
/// "Lykon/dreamshaper-xl-1-0"
/// "Lykon/dreamshaper-xl-v2-turbo"
#[serde(skip_serializing_if = "Option::is_none")]
pub model_name: Option<String>,
/// The negative prompt to use.Use it to address details that you don't want
/// in the image. This could be colors, objects, scenery and even the small details
/// (e.g. moustache, blurry, low resolution).
/// "cartoon, illustration, animation. face. male, female"
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// The number of images to generate.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_images: Option<i64>,
/// The number of inference steps to perform.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// The prompt to use for generating the image. Be as descriptive as possible for best results.
/// "a tiger sitting on a park bench"
pub prompt: String,
/// The version of the safety checker to use. v1 is the default CompVis safety checker. v2 uses a custom ViT model.
#[serde(skip_serializing_if = "Option::is_none")]
pub safety_checker_version: Option<String>,
/// The same seed and the same prompt given to the same version of Stable Diffusion
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// determines how much the generated image resembles the initial image
#[serde(skip_serializing_if = "Option::is_none")]
pub strength: Option<f64>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct DreamshaperTextToImageInput {
/// The list of embeddings to use.
#[serde(skip_serializing_if = "Option::is_none")]
pub embeddings: Option<Vec<Option<Embedding>>>,
/// If set to true, the safety checker will be enabled.
#[serde(skip_serializing_if = "Option::is_none")]
pub enable_safety_checker: Option<bool>,
/// If set to true, the prompt will be expanded with additional prompts.
#[serde(skip_serializing_if = "Option::is_none")]
pub expand_prompt: Option<bool>,
/// The format of the generated image.
#[serde(skip_serializing_if = "Option::is_none")]
pub format: Option<String>,
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want the model to stick to your prompt when looking for a related image to show you.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance_scale: Option<f64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub image_size: Option<ImageSizeProperty>,
/// The list of LoRA weights to use.
#[serde(skip_serializing_if = "Option::is_none")]
pub loras: Option<Vec<Option<LoraWeight>>>,
/// The Dreamshaper model to use.
/// "Lykon/dreamshaper-8"
/// "Lykon/dreamshaper-xl-1-0"
/// "Lykon/dreamshaper-xl-v2-turbo"
#[serde(skip_serializing_if = "Option::is_none")]
pub model_name: Option<String>,
/// The negative prompt to use. Use it to address details that you don't want in the image.
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// The number of images to generate.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_images: Option<i64>,
/// The number of inference steps to perform.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// The prompt to use for generating the image. Be as descriptive as possible for best results.
/// "A hyperdetailed photograph of a Cat dressed as a mafia boss holding a fish walking down a Japanese fish market with an angry face, 8k resolution, best quality, beautiful photograph, dynamic lighting,"
pub prompt: String,
/// The version of the safety checker to use. v1 is the default CompVis safety checker. v2 uses a custom ViT model.
#[serde(skip_serializing_if = "Option::is_none")]
pub safety_checker_version: Option<String>,
/// The same seed and the same prompt given to the same version of Stable Diffusion
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// If set to true, the function will wait for the image to be generated and uploaded
/// before returning the response. This will increase the latency of the function but
/// it allows you to get the image directly in the response without going through the CDN.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Embedding {
/// URL or the path to the embedding weights.
/// "https://civitai.com/api/download/models/135931"
/// "https://filebin.net/3chfqasxpqu21y8n/my-custom-lora-v1.safetensors"
pub path: String,
/// The list of tokens to use for the embedding.
#[serde(skip_serializing_if = "Option::is_none")]
pub tokens: Option<Vec<Option<String>>>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct HTTPValidationError {
#[serde(skip_serializing_if = "Option::is_none")]
pub detail: Option<Vec<Option<ValidationError>>>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Image {
#[serde(skip_serializing_if = "Option::is_none")]
pub content_type: Option<String>,
pub height: i64,
pub url: String,
pub width: i64,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ImageSize {
/// The height of the generated image.
#[serde(skip_serializing_if = "Option::is_none")]
pub height: Option<i64>,
/// The width of the generated image.
#[serde(skip_serializing_if = "Option::is_none")]
pub width: Option<i64>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct LoraWeight {
/// If set to true, the embedding will be forced to be used.
#[serde(skip_serializing_if = "Option::is_none")]
pub force: Option<bool>,
/// URL or the path to the LoRA weights. Or HF model name.
/// "https://civitai.com/api/download/models/135931"
/// "https://filebin.net/3chfqasxpqu21y8n/my-custom-lora-v1.safetensors"
pub path: String,
/// The scale of the LoRA weight. This is used to scale the LoRA weight
/// before merging it with the base model.
#[serde(skip_serializing_if = "Option::is_none")]
pub scale: Option<f64>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct Output {
/// Whether the generated images contain NSFW concepts.
pub has_nsfw_concepts: Vec<bool>,
/// The generated image files info.
pub images: Vec<Image>,
/// The prompt used for generating the image.
pub prompt: String,
/// Seed of the generated Image. It will be the same value of the one passed in the
/// input or the randomly generated that was used in case none was passed.
pub seed: i64,
pub timings: Timings,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ValidationError {
pub loc: Vec<serde_json::Value>,
pub msg: String,
#[serde(rename = "type")]
pub ty: String,
}
#[derive(Debug, Serialize, Deserialize, smart_default::SmartDefault)]
#[allow(non_camel_case_types)]
pub enum ImageSizeProperty {
#[default]
ImageSize(ImageSize),
#[serde(rename = "square_hd")]
SquareHd,
#[serde(rename = "square")]
Square,
#[serde(rename = "portrait_4_3")]
Portrait43,
#[serde(rename = "portrait_16_9")]
Portrait169,
#[serde(rename = "landscape_4_3")]
Landscape43,
#[serde(rename = "landscape_16_9")]
Landscape169,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Timings {
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(rename = "type")]
pub ty: Option<serde_json::Value>,
}
/// Dreamshaper
///
/// Category: text-to-image
/// Machine Type: A100
pub fn dreamshaper(
params: DreamshaperTextToImageInput,
) -> FalRequest<DreamshaperTextToImageInput, Output> {
FalRequest::new("fal-ai/dreamshaper", params)
}
@@ -0,0 +1,70 @@
#[allow(unused_imports)]
use crate::prelude::*;
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::collections::HashMap;
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct File {
/// The mime type of the file.
/// "image/png"
#[serde(skip_serializing_if = "Option::is_none")]
pub content_type: Option<String>,
/// File data
#[serde(skip_serializing_if = "Option::is_none")]
pub file_data: Option<String>,
/// The name of the file. It will be auto-generated if not provided.
/// "z9RV14K95DvU.png"
#[serde(skip_serializing_if = "Option::is_none")]
pub file_name: Option<String>,
/// The size of the file in bytes.
/// 4404019
#[serde(skip_serializing_if = "Option::is_none")]
pub file_size: Option<i64>,
/// The URL where the file can be downloaded from.
pub url: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct HTTPValidationError {
#[serde(skip_serializing_if = "Option::is_none")]
pub detail: Option<Vec<Option<ValidationError>>>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct InputModel {
/// Whether to lip sync the audio to the video
#[serde(skip_serializing_if = "Option::is_none")]
pub do_lipsync: Option<bool>,
/// Target language to dub the video to
#[serde(skip_serializing_if = "Option::is_none")]
pub target_language: Option<String>,
/// Input video URL to be dubbed.
/// "https://storage.googleapis.com/falserverless/model_tests/dubbing/swapjokes_clip_cropped.mp4"
pub video_url: String,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct OutputModel {
/// The generated video with the lip sync.
/// {"content_type":"video/mp4","file_name":"output.mp4","file_size":120000,"url":"https://v3.fal.media/files/koala/7BzEwUucbr6yuFjpcJipl_output.mp4"}
pub video: File,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ValidationError {
pub loc: Vec<serde_json::Value>,
pub msg: String,
#[serde(rename = "type")]
pub ty: String,
}
/// Dubbing
///
/// Category: video-to-video
///
/// License Type: commercial
pub fn dubbing(params: InputModel) -> FalRequest<InputModel, OutputModel> {
FalRequest::new("fal-ai/dubbing", params)
}
+70
View File
@@ -0,0 +1,70 @@
#[allow(unused_imports)]
use crate::prelude::*;
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::collections::HashMap;
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct DWPoseInput {
/// URL of the image to be processed
/// "https://github.com/badayvedat/sane-controlnet-aux/blob/main/tests/data/pose_sample.jpg?raw=true"
pub image_url: String,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct DWPoseOutput {
/// The predicted pose image
pub image: Image,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct HTTPValidationError {
#[serde(skip_serializing_if = "Option::is_none")]
pub detail: Option<Vec<Option<ValidationError>>>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Image {
/// The mime type of the file.
/// "image/png"
#[serde(skip_serializing_if = "Option::is_none")]
pub content_type: Option<String>,
/// File data
#[serde(skip_serializing_if = "Option::is_none")]
pub file_data: Option<String>,
/// The name of the file. It will be auto-generated if not provided.
/// "z9RV14K95DvU.png"
#[serde(skip_serializing_if = "Option::is_none")]
pub file_name: Option<String>,
/// The size of the file in bytes.
/// 4404019
#[serde(skip_serializing_if = "Option::is_none")]
pub file_size: Option<i64>,
/// The height of the image in pixels.
/// 1024
#[serde(skip_serializing_if = "Option::is_none")]
pub height: Option<i64>,
/// The URL where the file can be downloaded from.
pub url: String,
/// The width of the image in pixels.
/// 1024
#[serde(skip_serializing_if = "Option::is_none")]
pub width: Option<i64>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ValidationError {
pub loc: Vec<serde_json::Value>,
pub msg: String,
#[serde(rename = "type")]
pub ty: String,
}
/// DWPose Pose Prediction
///
/// Category: image-to-image
/// Machine Type: A6000
pub fn dwpose(params: DWPoseInput) -> FalRequest<DWPoseInput, DWPoseOutput> {
FalRequest::new("fal-ai/dwpose", params)
}
@@ -0,0 +1,203 @@
#[allow(unused_imports)]
use crate::prelude::*;
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::collections::HashMap;
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct AudioInput {
/// The input audio file
/// "https://v3.fal.media/files/zebra/zJL_oRY8h5RWwjoK1w7tx_output.mp3"
pub url: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct AudioIsolationRequest {
/// URL of the audio file to isolate voice from
/// "https://v3.fal.media/files/zebra/zJL_oRY8h5RWwjoK1w7tx_output.mp3"
pub audio_url: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct File {
/// The mime type of the file.
/// "image/png"
#[serde(skip_serializing_if = "Option::is_none")]
pub content_type: Option<String>,
/// File data
#[serde(skip_serializing_if = "Option::is_none")]
pub file_data: Option<String>,
/// The name of the file. It will be auto-generated if not provided.
/// "z9RV14K95DvU.png"
#[serde(skip_serializing_if = "Option::is_none")]
pub file_name: Option<String>,
/// The size of the file in bytes.
/// 4404019
#[serde(skip_serializing_if = "Option::is_none")]
pub file_size: Option<i64>,
/// The URL where the file can be downloaded from.
pub url: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct HTTPValidationError {
#[serde(skip_serializing_if = "Option::is_none")]
pub detail: Option<Vec<Option<ValidationError>>>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct SoundEffectOutput {
/// The generated sound effect audio file in MP3 format
/// {"url":"https://v3.fal.media/files/lion/WgnO-jy6WduosuG_Ibobx_sound_effect.mp3"}
pub audio: File,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct SoundEffectRequest {
/// Duration in seconds (0.5-22). If None, optimal duration will be determined from prompt.
#[serde(skip_serializing_if = "Option::is_none")]
pub duration_seconds: Option<f64>,
/// How closely to follow the prompt (0-1). Higher values mean less variation.
#[serde(skip_serializing_if = "Option::is_none")]
pub prompt_influence: Option<f64>,
/// The text describing the sound effect to generate
/// "Spacious braam suitable for high-impact movie trailer moments"
/// "A gentle wind chime tinkling in a soft breeze"
pub text: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct SpeechToTextRequest {
/// URL of the audio file to transcribe
/// "https://v3.fal.media/files/zebra/zJL_oRY8h5RWwjoK1w7tx_output.mp3"
pub audio_url: String,
/// Whether to annotate who is speaking
#[serde(skip_serializing_if = "Option::is_none")]
pub diarize: Option<bool>,
/// Language code of the audio
/// "eng"
/// "spa"
/// "fra"
/// "deu"
/// "jpn"
#[serde(skip_serializing_if = "Option::is_none")]
pub language_code: Option<String>,
/// Tag audio events like laughter, applause, etc.
#[serde(skip_serializing_if = "Option::is_none")]
pub tag_audio_events: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct TTSOutput {
/// The generated audio file
/// {"url":"https://v3.fal.media/files/zebra/zJL_oRY8h5RWwjoK1w7tx_output.mp3"}
pub audio: File,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct TextToSpeechRequest {
/// Similarity boost (0-1)
#[serde(skip_serializing_if = "Option::is_none")]
pub similarity_boost: Option<f64>,
/// Voice stability (0-1)
#[serde(skip_serializing_if = "Option::is_none")]
pub stability: Option<f64>,
/// Style exaggeration (0-1)
#[serde(skip_serializing_if = "Option::is_none")]
pub style: Option<f64>,
/// The text to convert to speech
/// "Hello! This is a test of the text to speech system, powered by ElevenLabs. How does it sound?"
pub text: String,
/// The voice to use for speech generation
/// "Aria"
/// "Roger"
/// "Sarah"
/// "Laura"
/// "Charlie"
/// "George"
/// "Callum"
/// "River"
/// "Liam"
/// "Charlotte"
/// "Alice"
/// "Matilda"
/// "Will"
/// "Jessica"
/// "Eric"
/// "Chris"
/// "Brian"
/// "Daniel"
/// "Lily"
/// "Bill"
#[serde(skip_serializing_if = "Option::is_none")]
pub voice: Option<String>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct TranscriptionOutput {
/// Detected or specified language code
pub language_code: String,
/// Confidence in language detection
pub language_probability: f64,
/// The full transcribed text
pub text: String,
/// Word-level transcription details
pub words: Vec<TranscriptionWord>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct TranscriptionWord {
/// End time in seconds
pub end: f64,
/// Speaker identifier if diarization was enabled
#[serde(skip_serializing_if = "Option::is_none")]
pub speaker_id: Option<String>,
/// Start time in seconds
pub start: f64,
/// The transcribed word or audio event
pub text: String,
/// Type of element (word, spacing, or audio_event)
#[serde(rename = "type")]
pub ty: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ValidationError {
pub loc: Vec<serde_json::Value>,
pub msg: String,
#[serde(rename = "type")]
pub ty: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct VoiceCloningOutput {
/// The id of the cloned voice
/// "hWom0fkbma5jw98sykZx"
pub voice_id: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct VoiceCloningRequest {
/// List of audio files to use for voice cloning
pub audio_urls: Vec<AudioInput>,
/// Whether to remove background noise from the audio files
#[serde(skip_serializing_if = "Option::is_none")]
pub remove_background_noise: Option<bool>,
}
/// ElevenLabs Audio Isolation
///
/// Category: audio-to-audio
///
/// License Type: commercial
///
/// ElevenLabs Audio Isolation: Extract clean voice from audio.
///
/// Isolates and enhances voice content from audio files, removing background noise,
/// music, and other non-voice sounds.
pub fn audio_isolation(
params: AudioIsolationRequest,
) -> FalRequest<AudioIsolationRequest, TTSOutput> {
FalRequest::new("fal-ai/elevenlabs/audio-isolation", params)
}
@@ -0,0 +1,200 @@
#[allow(unused_imports)]
use crate::prelude::*;
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::collections::HashMap;
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct AudioInput {
/// The input audio file
/// "https://v3.fal.media/files/zebra/zJL_oRY8h5RWwjoK1w7tx_output.mp3"
pub url: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct AudioIsolationRequest {
/// URL of the audio file to isolate voice from
/// "https://v3.fal.media/files/zebra/zJL_oRY8h5RWwjoK1w7tx_output.mp3"
pub audio_url: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct File {
/// The mime type of the file.
/// "image/png"
#[serde(skip_serializing_if = "Option::is_none")]
pub content_type: Option<String>,
/// File data
#[serde(skip_serializing_if = "Option::is_none")]
pub file_data: Option<String>,
/// The name of the file. It will be auto-generated if not provided.
/// "z9RV14K95DvU.png"
#[serde(skip_serializing_if = "Option::is_none")]
pub file_name: Option<String>,
/// The size of the file in bytes.
/// 4404019
#[serde(skip_serializing_if = "Option::is_none")]
pub file_size: Option<i64>,
/// The URL where the file can be downloaded from.
pub url: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct HTTPValidationError {
#[serde(skip_serializing_if = "Option::is_none")]
pub detail: Option<Vec<Option<ValidationError>>>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct SoundEffectOutput {
/// The generated sound effect audio file in MP3 format
/// {"url":"https://v3.fal.media/files/lion/WgnO-jy6WduosuG_Ibobx_sound_effect.mp3"}
pub audio: File,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct SoundEffectRequest {
/// Duration in seconds (0.5-22). If None, optimal duration will be determined from prompt.
#[serde(skip_serializing_if = "Option::is_none")]
pub duration_seconds: Option<f64>,
/// How closely to follow the prompt (0-1). Higher values mean less variation.
#[serde(skip_serializing_if = "Option::is_none")]
pub prompt_influence: Option<f64>,
/// The text describing the sound effect to generate
/// "Spacious braam suitable for high-impact movie trailer moments"
/// "A gentle wind chime tinkling in a soft breeze"
pub text: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct SpeechToTextRequest {
/// URL of the audio file to transcribe
/// "https://v3.fal.media/files/zebra/zJL_oRY8h5RWwjoK1w7tx_output.mp3"
pub audio_url: String,
/// Whether to annotate who is speaking
#[serde(skip_serializing_if = "Option::is_none")]
pub diarize: Option<bool>,
/// Language code of the audio
/// "eng"
/// "spa"
/// "fra"
/// "deu"
/// "jpn"
#[serde(skip_serializing_if = "Option::is_none")]
pub language_code: Option<String>,
/// Tag audio events like laughter, applause, etc.
#[serde(skip_serializing_if = "Option::is_none")]
pub tag_audio_events: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct TTSOutput {
/// The generated audio file
/// {"url":"https://v3.fal.media/files/zebra/zJL_oRY8h5RWwjoK1w7tx_output.mp3"}
pub audio: File,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct TextToSpeechRequest {
/// Similarity boost (0-1)
#[serde(skip_serializing_if = "Option::is_none")]
pub similarity_boost: Option<f64>,
/// Voice stability (0-1)
#[serde(skip_serializing_if = "Option::is_none")]
pub stability: Option<f64>,
/// Style exaggeration (0-1)
#[serde(skip_serializing_if = "Option::is_none")]
pub style: Option<f64>,
/// The text to convert to speech
/// "Hello! This is a test of the text to speech system, powered by ElevenLabs. How does it sound?"
pub text: String,
/// The voice to use for speech generation
/// "Aria"
/// "Roger"
/// "Sarah"
/// "Laura"
/// "Charlie"
/// "George"
/// "Callum"
/// "River"
/// "Liam"
/// "Charlotte"
/// "Alice"
/// "Matilda"
/// "Will"
/// "Jessica"
/// "Eric"
/// "Chris"
/// "Brian"
/// "Daniel"
/// "Lily"
/// "Bill"
#[serde(skip_serializing_if = "Option::is_none")]
pub voice: Option<String>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct TranscriptionOutput {
/// Detected or specified language code
pub language_code: String,
/// Confidence in language detection
pub language_probability: f64,
/// The full transcribed text
pub text: String,
/// Word-level transcription details
pub words: Vec<TranscriptionWord>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct TranscriptionWord {
/// End time in seconds
pub end: f64,
/// Speaker identifier if diarization was enabled
#[serde(skip_serializing_if = "Option::is_none")]
pub speaker_id: Option<String>,
/// Start time in seconds
pub start: f64,
/// The transcribed word or audio event
pub text: String,
/// Type of element (word, spacing, or audio_event)
#[serde(rename = "type")]
pub ty: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ValidationError {
pub loc: Vec<serde_json::Value>,
pub msg: String,
#[serde(rename = "type")]
pub ty: String,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct VoiceCloningOutput {
/// The id of the cloned voice
/// "hWom0fkbma5jw98sykZx"
pub voice_id: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct VoiceCloningRequest {
/// List of audio files to use for voice cloning
pub audio_urls: Vec<AudioInput>,
/// Whether to remove background noise from the audio files
#[serde(skip_serializing_if = "Option::is_none")]
pub remove_background_noise: Option<bool>,
}
/// ElevenLabs Audio Isolation
///
/// Category: audio-to-audio
///
/// License Type: commercial
///
/// ElevenLabs Voice Cloning: Add a new voice to the system.
pub fn clone_voice(
params: VoiceCloningRequest,
) -> FalRequest<VoiceCloningRequest, VoiceCloningOutput> {
FalRequest::new("fal-ai/elevenlabs/clone-voice", params)
}
@@ -0,0 +1,70 @@
#[cfg(any(
feature = "endpoints",
feature = "endpoints_fal-ai",
feature = "endpoints_fal-ai_elevenlabs"
))]
#[cfg_attr(
docsrs,
doc(cfg(any(
feature = "endpoints",
feature = "endpoints_fal-ai",
feature = "endpoints_fal-ai_elevenlabs"
)))
)]
pub mod audio_isolation;
#[cfg(any(
feature = "endpoints",
feature = "endpoints_fal-ai",
feature = "endpoints_fal-ai_elevenlabs"
))]
#[cfg_attr(
docsrs,
doc(cfg(any(
feature = "endpoints",
feature = "endpoints_fal-ai",
feature = "endpoints_fal-ai_elevenlabs"
)))
)]
pub mod clone_voice;
#[cfg(any(
feature = "endpoints",
feature = "endpoints_fal-ai",
feature = "endpoints_fal-ai_elevenlabs"
))]
#[cfg_attr(
docsrs,
doc(cfg(any(
feature = "endpoints",
feature = "endpoints_fal-ai",
feature = "endpoints_fal-ai_elevenlabs"
)))
)]
pub mod sound_effects;
#[cfg(any(
feature = "endpoints",
feature = "endpoints_fal-ai",
feature = "endpoints_fal-ai_elevenlabs"
))]
#[cfg_attr(
docsrs,
doc(cfg(any(
feature = "endpoints",
feature = "endpoints_fal-ai",
feature = "endpoints_fal-ai_elevenlabs"
)))
)]
pub mod speech_to_text;
#[cfg(any(
feature = "endpoints",
feature = "endpoints_fal-ai",
feature = "endpoints_fal-ai_elevenlabs"
))]
#[cfg_attr(
docsrs,
doc(cfg(any(
feature = "endpoints",
feature = "endpoints_fal-ai",
feature = "endpoints_fal-ai_elevenlabs"
)))
)]
pub mod tts;
@@ -0,0 +1,203 @@
#[allow(unused_imports)]
use crate::prelude::*;
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::collections::HashMap;
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct AudioInput {
/// The input audio file
/// "https://v3.fal.media/files/zebra/zJL_oRY8h5RWwjoK1w7tx_output.mp3"
pub url: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct AudioIsolationRequest {
/// URL of the audio file to isolate voice from
/// "https://v3.fal.media/files/zebra/zJL_oRY8h5RWwjoK1w7tx_output.mp3"
pub audio_url: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct File {
/// The mime type of the file.
/// "image/png"
#[serde(skip_serializing_if = "Option::is_none")]
pub content_type: Option<String>,
/// File data
#[serde(skip_serializing_if = "Option::is_none")]
pub file_data: Option<String>,
/// The name of the file. It will be auto-generated if not provided.
/// "z9RV14K95DvU.png"
#[serde(skip_serializing_if = "Option::is_none")]
pub file_name: Option<String>,
/// The size of the file in bytes.
/// 4404019
#[serde(skip_serializing_if = "Option::is_none")]
pub file_size: Option<i64>,
/// The URL where the file can be downloaded from.
pub url: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct HTTPValidationError {
#[serde(skip_serializing_if = "Option::is_none")]
pub detail: Option<Vec<Option<ValidationError>>>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct SoundEffectOutput {
/// The generated sound effect audio file in MP3 format
/// {"url":"https://v3.fal.media/files/lion/WgnO-jy6WduosuG_Ibobx_sound_effect.mp3"}
pub audio: File,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct SoundEffectRequest {
/// Duration in seconds (0.5-22). If None, optimal duration will be determined from prompt.
#[serde(skip_serializing_if = "Option::is_none")]
pub duration_seconds: Option<f64>,
/// How closely to follow the prompt (0-1). Higher values mean less variation.
#[serde(skip_serializing_if = "Option::is_none")]
pub prompt_influence: Option<f64>,
/// The text describing the sound effect to generate
/// "Spacious braam suitable for high-impact movie trailer moments"
/// "A gentle wind chime tinkling in a soft breeze"
pub text: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct SpeechToTextRequest {
/// URL of the audio file to transcribe
/// "https://v3.fal.media/files/zebra/zJL_oRY8h5RWwjoK1w7tx_output.mp3"
pub audio_url: String,
/// Whether to annotate who is speaking
#[serde(skip_serializing_if = "Option::is_none")]
pub diarize: Option<bool>,
/// Language code of the audio
/// "eng"
/// "spa"
/// "fra"
/// "deu"
/// "jpn"
#[serde(skip_serializing_if = "Option::is_none")]
pub language_code: Option<String>,
/// Tag audio events like laughter, applause, etc.
#[serde(skip_serializing_if = "Option::is_none")]
pub tag_audio_events: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct TTSOutput {
/// The generated audio file
/// {"url":"https://v3.fal.media/files/zebra/zJL_oRY8h5RWwjoK1w7tx_output.mp3"}
pub audio: File,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct TextToSpeechRequest {
/// Similarity boost (0-1)
#[serde(skip_serializing_if = "Option::is_none")]
pub similarity_boost: Option<f64>,
/// Voice stability (0-1)
#[serde(skip_serializing_if = "Option::is_none")]
pub stability: Option<f64>,
/// Style exaggeration (0-1)
#[serde(skip_serializing_if = "Option::is_none")]
pub style: Option<f64>,
/// The text to convert to speech
/// "Hello! This is a test of the text to speech system, powered by ElevenLabs. How does it sound?"
pub text: String,
/// The voice to use for speech generation
/// "Aria"
/// "Roger"
/// "Sarah"
/// "Laura"
/// "Charlie"
/// "George"
/// "Callum"
/// "River"
/// "Liam"
/// "Charlotte"
/// "Alice"
/// "Matilda"
/// "Will"
/// "Jessica"
/// "Eric"
/// "Chris"
/// "Brian"
/// "Daniel"
/// "Lily"
/// "Bill"
#[serde(skip_serializing_if = "Option::is_none")]
pub voice: Option<String>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct TranscriptionOutput {
/// Detected or specified language code
pub language_code: String,
/// Confidence in language detection
pub language_probability: f64,
/// The full transcribed text
pub text: String,
/// Word-level transcription details
pub words: Vec<TranscriptionWord>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct TranscriptionWord {
/// End time in seconds
pub end: f64,
/// Speaker identifier if diarization was enabled
#[serde(skip_serializing_if = "Option::is_none")]
pub speaker_id: Option<String>,
/// Start time in seconds
pub start: f64,
/// The transcribed word or audio event
pub text: String,
/// Type of element (word, spacing, or audio_event)
#[serde(rename = "type")]
pub ty: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ValidationError {
pub loc: Vec<serde_json::Value>,
pub msg: String,
#[serde(rename = "type")]
pub ty: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct VoiceCloningOutput {
/// The id of the cloned voice
/// "hWom0fkbma5jw98sykZx"
pub voice_id: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct VoiceCloningRequest {
/// List of audio files to use for voice cloning
pub audio_urls: Vec<AudioInput>,
/// Whether to remove background noise from the audio files
#[serde(skip_serializing_if = "Option::is_none")]
pub remove_background_noise: Option<bool>,
}
/// ElevenLabs Audio Isolation
///
/// Category: audio-to-audio
///
/// License Type: commercial
///
/// ElevenLabs Sound Effects Generation.
///
/// Turn text into sound effects for videos, voice-overs or video games using
/// state-of-the-art sound generation technology.
pub fn sound_effects(
params: SoundEffectRequest,
) -> FalRequest<SoundEffectRequest, SoundEffectOutput> {
FalRequest::new("fal-ai/elevenlabs/sound-effects", params)
}
@@ -0,0 +1,203 @@
#[allow(unused_imports)]
use crate::prelude::*;
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::collections::HashMap;
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct AudioInput {
/// The input audio file
/// "https://v3.fal.media/files/zebra/zJL_oRY8h5RWwjoK1w7tx_output.mp3"
pub url: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct AudioIsolationRequest {
/// URL of the audio file to isolate voice from
/// "https://v3.fal.media/files/zebra/zJL_oRY8h5RWwjoK1w7tx_output.mp3"
pub audio_url: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct File {
/// The mime type of the file.
/// "image/png"
#[serde(skip_serializing_if = "Option::is_none")]
pub content_type: Option<String>,
/// File data
#[serde(skip_serializing_if = "Option::is_none")]
pub file_data: Option<String>,
/// The name of the file. It will be auto-generated if not provided.
/// "z9RV14K95DvU.png"
#[serde(skip_serializing_if = "Option::is_none")]
pub file_name: Option<String>,
/// The size of the file in bytes.
/// 4404019
#[serde(skip_serializing_if = "Option::is_none")]
pub file_size: Option<i64>,
/// The URL where the file can be downloaded from.
pub url: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct HTTPValidationError {
#[serde(skip_serializing_if = "Option::is_none")]
pub detail: Option<Vec<Option<ValidationError>>>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct SoundEffectOutput {
/// The generated sound effect audio file in MP3 format
/// {"url":"https://v3.fal.media/files/lion/WgnO-jy6WduosuG_Ibobx_sound_effect.mp3"}
pub audio: File,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct SoundEffectRequest {
/// Duration in seconds (0.5-22). If None, optimal duration will be determined from prompt.
#[serde(skip_serializing_if = "Option::is_none")]
pub duration_seconds: Option<f64>,
/// How closely to follow the prompt (0-1). Higher values mean less variation.
#[serde(skip_serializing_if = "Option::is_none")]
pub prompt_influence: Option<f64>,
/// The text describing the sound effect to generate
/// "Spacious braam suitable for high-impact movie trailer moments"
/// "A gentle wind chime tinkling in a soft breeze"
pub text: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct SpeechToTextRequest {
/// URL of the audio file to transcribe
/// "https://v3.fal.media/files/zebra/zJL_oRY8h5RWwjoK1w7tx_output.mp3"
pub audio_url: String,
/// Whether to annotate who is speaking
#[serde(skip_serializing_if = "Option::is_none")]
pub diarize: Option<bool>,
/// Language code of the audio
/// "eng"
/// "spa"
/// "fra"
/// "deu"
/// "jpn"
#[serde(skip_serializing_if = "Option::is_none")]
pub language_code: Option<String>,
/// Tag audio events like laughter, applause, etc.
#[serde(skip_serializing_if = "Option::is_none")]
pub tag_audio_events: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct TTSOutput {
/// The generated audio file
/// {"url":"https://v3.fal.media/files/zebra/zJL_oRY8h5RWwjoK1w7tx_output.mp3"}
pub audio: File,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct TextToSpeechRequest {
/// Similarity boost (0-1)
#[serde(skip_serializing_if = "Option::is_none")]
pub similarity_boost: Option<f64>,
/// Voice stability (0-1)
#[serde(skip_serializing_if = "Option::is_none")]
pub stability: Option<f64>,
/// Style exaggeration (0-1)
#[serde(skip_serializing_if = "Option::is_none")]
pub style: Option<f64>,
/// The text to convert to speech
/// "Hello! This is a test of the text to speech system, powered by ElevenLabs. How does it sound?"
pub text: String,
/// The voice to use for speech generation
/// "Aria"
/// "Roger"
/// "Sarah"
/// "Laura"
/// "Charlie"
/// "George"
/// "Callum"
/// "River"
/// "Liam"
/// "Charlotte"
/// "Alice"
/// "Matilda"
/// "Will"
/// "Jessica"
/// "Eric"
/// "Chris"
/// "Brian"
/// "Daniel"
/// "Lily"
/// "Bill"
#[serde(skip_serializing_if = "Option::is_none")]
pub voice: Option<String>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct TranscriptionOutput {
/// Detected or specified language code
pub language_code: String,
/// Confidence in language detection
pub language_probability: f64,
/// The full transcribed text
pub text: String,
/// Word-level transcription details
pub words: Vec<TranscriptionWord>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct TranscriptionWord {
/// End time in seconds
pub end: f64,
/// Speaker identifier if diarization was enabled
#[serde(skip_serializing_if = "Option::is_none")]
pub speaker_id: Option<String>,
/// Start time in seconds
pub start: f64,
/// The transcribed word or audio event
pub text: String,
/// Type of element (word, spacing, or audio_event)
#[serde(rename = "type")]
pub ty: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ValidationError {
pub loc: Vec<serde_json::Value>,
pub msg: String,
#[serde(rename = "type")]
pub ty: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct VoiceCloningOutput {
/// The id of the cloned voice
/// "hWom0fkbma5jw98sykZx"
pub voice_id: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct VoiceCloningRequest {
/// List of audio files to use for voice cloning
pub audio_urls: Vec<AudioInput>,
/// Whether to remove background noise from the audio files
#[serde(skip_serializing_if = "Option::is_none")]
pub remove_background_noise: Option<bool>,
}
/// ElevenLabs Audio Isolation
///
/// Category: audio-to-audio
///
/// License Type: commercial
///
/// ElevenLabs Speech to Text: Transcribe audio with high accuracy.
///
/// Transforms spoken audio into text with word-level timestamps and
/// optional speaker identification. Supports 99 languages with state-of-the-art accuracy.
pub fn speech_to_text(
params: SpeechToTextRequest,
) -> FalRequest<SpeechToTextRequest, TranscriptionOutput> {
FalRequest::new("fal-ai/elevenlabs/speech-to-text", params)
}
@@ -0,0 +1,28 @@
#[cfg(any(
feature = "endpoints",
feature = "endpoints_fal-ai",
feature = "endpoints_fal-ai_elevenlabs"
))]
#[cfg_attr(
docsrs,
doc(cfg(any(
feature = "endpoints",
feature = "endpoints_fal-ai",
feature = "endpoints_fal-ai_elevenlabs"
)))
)]
pub mod multilingual_v2;
#[cfg(any(
feature = "endpoints",
feature = "endpoints_fal-ai",
feature = "endpoints_fal-ai_elevenlabs"
))]
#[cfg_attr(
docsrs,
doc(cfg(any(
feature = "endpoints",
feature = "endpoints_fal-ai",
feature = "endpoints_fal-ai_elevenlabs"
)))
)]
pub mod turbo_v2_5;
@@ -0,0 +1,201 @@
#[allow(unused_imports)]
use crate::prelude::*;
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::collections::HashMap;
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct AudioInput {
/// The input audio file
/// "https://v3.fal.media/files/zebra/zJL_oRY8h5RWwjoK1w7tx_output.mp3"
pub url: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct AudioIsolationRequest {
/// URL of the audio file to isolate voice from
/// "https://v3.fal.media/files/zebra/zJL_oRY8h5RWwjoK1w7tx_output.mp3"
pub audio_url: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct File {
/// The mime type of the file.
/// "image/png"
#[serde(skip_serializing_if = "Option::is_none")]
pub content_type: Option<String>,
/// File data
#[serde(skip_serializing_if = "Option::is_none")]
pub file_data: Option<String>,
/// The name of the file. It will be auto-generated if not provided.
/// "z9RV14K95DvU.png"
#[serde(skip_serializing_if = "Option::is_none")]
pub file_name: Option<String>,
/// The size of the file in bytes.
/// 4404019
#[serde(skip_serializing_if = "Option::is_none")]
pub file_size: Option<i64>,
/// The URL where the file can be downloaded from.
pub url: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct HTTPValidationError {
#[serde(skip_serializing_if = "Option::is_none")]
pub detail: Option<Vec<Option<ValidationError>>>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct SoundEffectOutput {
/// The generated sound effect audio file in MP3 format
/// {"url":"https://v3.fal.media/files/lion/WgnO-jy6WduosuG_Ibobx_sound_effect.mp3"}
pub audio: File,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct SoundEffectRequest {
/// Duration in seconds (0.5-22). If None, optimal duration will be determined from prompt.
#[serde(skip_serializing_if = "Option::is_none")]
pub duration_seconds: Option<f64>,
/// How closely to follow the prompt (0-1). Higher values mean less variation.
#[serde(skip_serializing_if = "Option::is_none")]
pub prompt_influence: Option<f64>,
/// The text describing the sound effect to generate
/// "Spacious braam suitable for high-impact movie trailer moments"
/// "A gentle wind chime tinkling in a soft breeze"
pub text: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct SpeechToTextRequest {
/// URL of the audio file to transcribe
/// "https://v3.fal.media/files/zebra/zJL_oRY8h5RWwjoK1w7tx_output.mp3"
pub audio_url: String,
/// Whether to annotate who is speaking
#[serde(skip_serializing_if = "Option::is_none")]
pub diarize: Option<bool>,
/// Language code of the audio
/// "eng"
/// "spa"
/// "fra"
/// "deu"
/// "jpn"
#[serde(skip_serializing_if = "Option::is_none")]
pub language_code: Option<String>,
/// Tag audio events like laughter, applause, etc.
#[serde(skip_serializing_if = "Option::is_none")]
pub tag_audio_events: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct TTSOutput {
/// The generated audio file
/// {"url":"https://v3.fal.media/files/zebra/zJL_oRY8h5RWwjoK1w7tx_output.mp3"}
pub audio: File,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct TextToSpeechRequest {
/// Similarity boost (0-1)
#[serde(skip_serializing_if = "Option::is_none")]
pub similarity_boost: Option<f64>,
/// Voice stability (0-1)
#[serde(skip_serializing_if = "Option::is_none")]
pub stability: Option<f64>,
/// Style exaggeration (0-1)
#[serde(skip_serializing_if = "Option::is_none")]
pub style: Option<f64>,
/// The text to convert to speech
/// "Hello! This is a test of the text to speech system, powered by ElevenLabs. How does it sound?"
pub text: String,
/// The voice to use for speech generation
/// "Aria"
/// "Roger"
/// "Sarah"
/// "Laura"
/// "Charlie"
/// "George"
/// "Callum"
/// "River"
/// "Liam"
/// "Charlotte"
/// "Alice"
/// "Matilda"
/// "Will"
/// "Jessica"
/// "Eric"
/// "Chris"
/// "Brian"
/// "Daniel"
/// "Lily"
/// "Bill"
#[serde(skip_serializing_if = "Option::is_none")]
pub voice: Option<String>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct TranscriptionOutput {
/// Detected or specified language code
pub language_code: String,
/// Confidence in language detection
pub language_probability: f64,
/// The full transcribed text
pub text: String,
/// Word-level transcription details
pub words: Vec<TranscriptionWord>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct TranscriptionWord {
/// End time in seconds
pub end: f64,
/// Speaker identifier if diarization was enabled
#[serde(skip_serializing_if = "Option::is_none")]
pub speaker_id: Option<String>,
/// Start time in seconds
pub start: f64,
/// The transcribed word or audio event
pub text: String,
/// Type of element (word, spacing, or audio_event)
#[serde(rename = "type")]
pub ty: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ValidationError {
pub loc: Vec<serde_json::Value>,
pub msg: String,
#[serde(rename = "type")]
pub ty: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct VoiceCloningOutput {
/// The id of the cloned voice
/// "hWom0fkbma5jw98sykZx"
pub voice_id: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct VoiceCloningRequest {
/// List of audio files to use for voice cloning
pub audio_urls: Vec<AudioInput>,
/// Whether to remove background noise from the audio files
#[serde(skip_serializing_if = "Option::is_none")]
pub remove_background_noise: Option<bool>,
}
/// ElevenLabs Audio Isolation
///
/// Category: audio-to-audio
///
/// License Type: commercial
///
/// ElevenLabs Multilingual v2 model for text-to-speech generation.
///
/// Excels in stability, language diversity, and accent accuracy.
/// Supports 29 languages with high-quality, natural-sounding voices.
pub fn multilingual_v2(params: TextToSpeechRequest) -> FalRequest<TextToSpeechRequest, TTSOutput> {
FalRequest::new("fal-ai/elevenlabs/tts/multilingual-v2", params)
}
@@ -0,0 +1,201 @@
#[allow(unused_imports)]
use crate::prelude::*;
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::collections::HashMap;
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct AudioInput {
/// The input audio file
/// "https://v3.fal.media/files/zebra/zJL_oRY8h5RWwjoK1w7tx_output.mp3"
pub url: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct AudioIsolationRequest {
/// URL of the audio file to isolate voice from
/// "https://v3.fal.media/files/zebra/zJL_oRY8h5RWwjoK1w7tx_output.mp3"
pub audio_url: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct File {
/// The mime type of the file.
/// "image/png"
#[serde(skip_serializing_if = "Option::is_none")]
pub content_type: Option<String>,
/// File data
#[serde(skip_serializing_if = "Option::is_none")]
pub file_data: Option<String>,
/// The name of the file. It will be auto-generated if not provided.
/// "z9RV14K95DvU.png"
#[serde(skip_serializing_if = "Option::is_none")]
pub file_name: Option<String>,
/// The size of the file in bytes.
/// 4404019
#[serde(skip_serializing_if = "Option::is_none")]
pub file_size: Option<i64>,
/// The URL where the file can be downloaded from.
pub url: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct HTTPValidationError {
#[serde(skip_serializing_if = "Option::is_none")]
pub detail: Option<Vec<Option<ValidationError>>>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct SoundEffectOutput {
/// The generated sound effect audio file in MP3 format
/// {"url":"https://v3.fal.media/files/lion/WgnO-jy6WduosuG_Ibobx_sound_effect.mp3"}
pub audio: File,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct SoundEffectRequest {
/// Duration in seconds (0.5-22). If None, optimal duration will be determined from prompt.
#[serde(skip_serializing_if = "Option::is_none")]
pub duration_seconds: Option<f64>,
/// How closely to follow the prompt (0-1). Higher values mean less variation.
#[serde(skip_serializing_if = "Option::is_none")]
pub prompt_influence: Option<f64>,
/// The text describing the sound effect to generate
/// "Spacious braam suitable for high-impact movie trailer moments"
/// "A gentle wind chime tinkling in a soft breeze"
pub text: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct SpeechToTextRequest {
/// URL of the audio file to transcribe
/// "https://v3.fal.media/files/zebra/zJL_oRY8h5RWwjoK1w7tx_output.mp3"
pub audio_url: String,
/// Whether to annotate who is speaking
#[serde(skip_serializing_if = "Option::is_none")]
pub diarize: Option<bool>,
/// Language code of the audio
/// "eng"
/// "spa"
/// "fra"
/// "deu"
/// "jpn"
#[serde(skip_serializing_if = "Option::is_none")]
pub language_code: Option<String>,
/// Tag audio events like laughter, applause, etc.
#[serde(skip_serializing_if = "Option::is_none")]
pub tag_audio_events: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct TTSOutput {
/// The generated audio file
/// {"url":"https://v3.fal.media/files/zebra/zJL_oRY8h5RWwjoK1w7tx_output.mp3"}
pub audio: File,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct TextToSpeechRequest {
/// Similarity boost (0-1)
#[serde(skip_serializing_if = "Option::is_none")]
pub similarity_boost: Option<f64>,
/// Voice stability (0-1)
#[serde(skip_serializing_if = "Option::is_none")]
pub stability: Option<f64>,
/// Style exaggeration (0-1)
#[serde(skip_serializing_if = "Option::is_none")]
pub style: Option<f64>,
/// The text to convert to speech
/// "Hello! This is a test of the text to speech system, powered by ElevenLabs. How does it sound?"
pub text: String,
/// The voice to use for speech generation
/// "Aria"
/// "Roger"
/// "Sarah"
/// "Laura"
/// "Charlie"
/// "George"
/// "Callum"
/// "River"
/// "Liam"
/// "Charlotte"
/// "Alice"
/// "Matilda"
/// "Will"
/// "Jessica"
/// "Eric"
/// "Chris"
/// "Brian"
/// "Daniel"
/// "Lily"
/// "Bill"
#[serde(skip_serializing_if = "Option::is_none")]
pub voice: Option<String>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct TranscriptionOutput {
/// Detected or specified language code
pub language_code: String,
/// Confidence in language detection
pub language_probability: f64,
/// The full transcribed text
pub text: String,
/// Word-level transcription details
pub words: Vec<TranscriptionWord>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct TranscriptionWord {
/// End time in seconds
pub end: f64,
/// Speaker identifier if diarization was enabled
#[serde(skip_serializing_if = "Option::is_none")]
pub speaker_id: Option<String>,
/// Start time in seconds
pub start: f64,
/// The transcribed word or audio event
pub text: String,
/// Type of element (word, spacing, or audio_event)
#[serde(rename = "type")]
pub ty: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ValidationError {
pub loc: Vec<serde_json::Value>,
pub msg: String,
#[serde(rename = "type")]
pub ty: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct VoiceCloningOutput {
/// The id of the cloned voice
/// "hWom0fkbma5jw98sykZx"
pub voice_id: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct VoiceCloningRequest {
/// List of audio files to use for voice cloning
pub audio_urls: Vec<AudioInput>,
/// Whether to remove background noise from the audio files
#[serde(skip_serializing_if = "Option::is_none")]
pub remove_background_noise: Option<bool>,
}
/// ElevenLabs Audio Isolation
///
/// Category: audio-to-audio
///
/// License Type: commercial
///
/// ElevenLabs Turbo v2.5 model for text-to-speech generation.
///
/// High quality with lowest latency, ideal for real-time applications.
/// Supports 32 languages while maintaining natural voice quality.
pub fn turbo_v2_5(params: TextToSpeechRequest) -> FalRequest<TextToSpeechRequest, TTSOutput> {
FalRequest::new("fal-ai/elevenlabs/tts/turbo-v2.5", params)
}
+127
View File
@@ -0,0 +1,127 @@
#[allow(unused_imports)]
use crate::prelude::*;
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::collections::HashMap;
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Era3DInput {
/// Background removal
#[serde(skip_serializing_if = "Option::is_none")]
pub background_removal: Option<bool>,
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want the model to stick to your prompt when looking for a related image to show you.
#[serde(skip_serializing_if = "Option::is_none")]
pub cfg: Option<f64>,
/// Size of the image to crop to
#[serde(skip_serializing_if = "Option::is_none")]
pub crop_size: Option<i64>,
/// URL of the image to remove background from
/// "https://storage.googleapis.com/falserverless/model_tests/era3d/DnvGjd9CCS-ESmLgTYgOn.png"
pub image_url: String,
/// Seed for random number generation
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// Number of steps to run the model for
#[serde(skip_serializing_if = "Option::is_none")]
pub steps: Option<i64>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct Era3DOutput {
/// Images with background removed
pub images: Vec<Image>,
/// Normal images with background removed
pub normal_images: Vec<Image>,
/// Seed used for random number generation
pub seed: i64,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct HTTPValidationError {
#[serde(skip_serializing_if = "Option::is_none")]
pub detail: Option<Vec<Option<ValidationError>>>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Image {
/// The mime type of the file.
/// "image/png"
#[serde(skip_serializing_if = "Option::is_none")]
pub content_type: Option<ContentTypeProperty>,
/// The name of the file. It will be auto-generated if not provided.
/// "z9RV14K95DvU.png"
#[serde(skip_serializing_if = "Option::is_none")]
pub file_name: Option<FileNameProperty>,
/// The size of the file in bytes.
/// 4404019
#[serde(skip_serializing_if = "Option::is_none")]
pub file_size: Option<FileSizeProperty>,
/// The height of the image in pixels.
/// 1024
#[serde(skip_serializing_if = "Option::is_none")]
pub height: Option<HeightProperty>,
/// The URL where the file can be downloaded from.
pub url: String,
/// The width of the image in pixels.
/// 1024
#[serde(skip_serializing_if = "Option::is_none")]
pub width: Option<WidthProperty>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ValidationError {
pub loc: Vec<serde_json::Value>,
pub msg: String,
#[serde(rename = "type")]
pub ty: String,
}
#[derive(Debug, Serialize, Deserialize, smart_default::SmartDefault)]
#[allow(non_camel_case_types)]
pub enum ContentTypeProperty {
#[default]
String(String),
Null(serde_json::Value),
}
#[derive(Debug, Serialize, Deserialize, smart_default::SmartDefault)]
#[allow(non_camel_case_types)]
pub enum FileNameProperty {
#[default]
String(String),
Null(serde_json::Value),
}
#[derive(Debug, Serialize, Deserialize, smart_default::SmartDefault)]
#[allow(non_camel_case_types)]
pub enum FileSizeProperty {
#[default]
Integer(i64),
Null(serde_json::Value),
}
#[derive(Debug, Serialize, Deserialize, smart_default::SmartDefault)]
#[allow(non_camel_case_types)]
pub enum HeightProperty {
#[default]
Integer(i64),
Null(serde_json::Value),
}
#[derive(Debug, Serialize, Deserialize, smart_default::SmartDefault)]
#[allow(non_camel_case_types)]
pub enum WidthProperty {
#[default]
Integer(i64),
Null(serde_json::Value),
}
/// Era 3D
///
/// Category: image-to-image
/// Machine Type: A100
/// License Type: commercial
pub fn era_3d(params: Era3DInput) -> FalRequest<Era3DInput, Era3DOutput> {
FalRequest::new("fal-ai/era-3d", params)
}
+124
View File
@@ -0,0 +1,124 @@
#[allow(unused_imports)]
use crate::prelude::*;
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::collections::HashMap;
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct HTTPValidationError {
#[serde(skip_serializing_if = "Option::is_none")]
pub detail: Option<Vec<Option<ValidationError>>>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Image {
/// The mime type of the file.
/// "image/png"
#[serde(skip_serializing_if = "Option::is_none")]
pub content_type: Option<ContentTypeProperty>,
/// The name of the file. It will be auto-generated if not provided.
/// "z9RV14K95DvU.png"
#[serde(skip_serializing_if = "Option::is_none")]
pub file_name: Option<FileNameProperty>,
/// The size of the file in bytes.
/// 4404019
#[serde(skip_serializing_if = "Option::is_none")]
pub file_size: Option<FileSizeProperty>,
/// The height of the image in pixels.
/// 1024
#[serde(skip_serializing_if = "Option::is_none")]
pub height: Option<HeightProperty>,
/// The URL where the file can be downloaded from.
pub url: String,
/// The width of the image in pixels.
/// 1024
#[serde(skip_serializing_if = "Option::is_none")]
pub width: Option<WidthProperty>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct UpscaleInput {
/// Upscaling a face
#[serde(skip_serializing_if = "Option::is_none")]
pub face: Option<bool>,
/// Url to input image
/// "https://storage.googleapis.com/falserverless/model_tests/remove_background/elephant.jpg"
/// "https://storage.googleapis.com/falserverless/gallery/blue-bird.jpeg"
/// "https://storage.googleapis.com/falserverless/model_tests/upscale/image%20(8).png"
pub image_url: String,
/// Model to use for upscaling
#[serde(skip_serializing_if = "Option::is_none")]
pub model: Option<String>,
/// Output image format (png or jpeg)
#[serde(skip_serializing_if = "Option::is_none")]
pub output_format: Option<String>,
/// Rescaling factor
#[serde(skip_serializing_if = "Option::is_none")]
pub scale: Option<f64>,
/// Tile size. Default is 0, that is no tile. When encountering the out-of-GPU-memory issue, please specify it, e.g., 400 or 200
#[serde(skip_serializing_if = "Option::is_none")]
pub tile: Option<i64>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct UpscaleOutput {
/// Upscaled image
pub image: Image,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ValidationError {
pub loc: Vec<serde_json::Value>,
pub msg: String,
#[serde(rename = "type")]
pub ty: String,
}
#[derive(Debug, Serialize, Deserialize, smart_default::SmartDefault)]
#[allow(non_camel_case_types)]
pub enum ContentTypeProperty {
#[default]
String(String),
Null(serde_json::Value),
}
#[derive(Debug, Serialize, Deserialize, smart_default::SmartDefault)]
#[allow(non_camel_case_types)]
pub enum FileNameProperty {
#[default]
String(String),
Null(serde_json::Value),
}
#[derive(Debug, Serialize, Deserialize, smart_default::SmartDefault)]
#[allow(non_camel_case_types)]
pub enum FileSizeProperty {
#[default]
Integer(i64),
Null(serde_json::Value),
}
#[derive(Debug, Serialize, Deserialize, smart_default::SmartDefault)]
#[allow(non_camel_case_types)]
pub enum HeightProperty {
#[default]
Integer(i64),
Null(serde_json::Value),
}
#[derive(Debug, Serialize, Deserialize, smart_default::SmartDefault)]
#[allow(non_camel_case_types)]
pub enum WidthProperty {
#[default]
Integer(i64),
Null(serde_json::Value),
}
/// Upscale Images
///
/// Category: image-to-image
/// Machine Type: A6000
pub fn esrgan(params: UpscaleInput) -> FalRequest<UpscaleInput, UpscaleOutput> {
FalRequest::new("fal-ai/esrgan", params)
}
@@ -0,0 +1,88 @@
#[allow(unused_imports)]
use crate::prelude::*;
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::collections::HashMap;
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct File {
/// The mime type of the file.
/// "image/png"
#[serde(skip_serializing_if = "Option::is_none")]
pub content_type: Option<String>,
/// File data
#[serde(skip_serializing_if = "Option::is_none")]
pub file_data: Option<String>,
/// The name of the file. It will be auto-generated if not provided.
/// "z9RV14K95DvU.png"
#[serde(skip_serializing_if = "Option::is_none")]
pub file_name: Option<String>,
/// The size of the file in bytes.
/// 4404019
#[serde(skip_serializing_if = "Option::is_none")]
pub file_size: Option<i64>,
/// The URL where the file can be downloaded from.
pub url: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct HTTPValidationError {
#[serde(skip_serializing_if = "Option::is_none")]
pub detail: Option<Vec<Option<ValidationError>>>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ImageInput {
/// Apply Gaussian blur to the mask. Value determines kernel size (must be odd number)
#[serde(skip_serializing_if = "Option::is_none")]
pub blur_mask: Option<i64>,
/// Expand/dilate the mask by specified pixels
#[serde(skip_serializing_if = "Option::is_none")]
pub expand_mask: Option<i64>,
/// Fill holes in the mask using morphological operations
#[serde(skip_serializing_if = "Option::is_none")]
pub fill_holes: Option<bool>,
/// URL of the input image
/// "https://storage.googleapis.com/falserverless/web-examples/evf-sam2/evfsam2-cat.png"
pub image_url: String,
/// Output only the binary mask instead of masked image
#[serde(skip_serializing_if = "Option::is_none")]
pub mask_only: Option<bool>,
/// Areas to exclude from segmentation (will be subtracted from prompt results)
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// The prompt to generate segmentation from.
/// "Cat in the middle of the image"
pub prompt: String,
/// Invert the mask (background becomes foreground and vice versa)
#[serde(skip_serializing_if = "Option::is_none")]
pub revert_mask: Option<bool>,
/// Enable semantic level segmentation for body parts, background or multi objects
#[serde(skip_serializing_if = "Option::is_none")]
pub semantic_type: Option<bool>,
/// Use GroundingDINO instead of SAM for segmentation
#[serde(skip_serializing_if = "Option::is_none")]
pub use_grounding_dino: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct ImageOutput {
/// The segmented output image
pub image: File,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ValidationError {
pub loc: Vec<serde_json::Value>,
pub msg: String,
#[serde(rename = "type")]
pub ty: String,
}
/// EVF-SAM2 Segmentation
///
/// Category: image-to-image
pub fn evf_sam(params: ImageInput) -> FalRequest<ImageInput, ImageOutput> {
FalRequest::new("fal-ai/evf-sam", params)
}
@@ -0,0 +1,61 @@
#[allow(unused_imports)]
use crate::prelude::*;
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::collections::HashMap;
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct EyeCorrectInput {
/// The URL of the video to correct
pub video_url: String,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct EyeCorrectOutput {
/// The corrected video
pub video: File,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct File {
/// The mime type of the file.
/// "image/png"
#[serde(skip_serializing_if = "Option::is_none")]
pub content_type: Option<String>,
/// File data
#[serde(skip_serializing_if = "Option::is_none")]
pub file_data: Option<String>,
/// The name of the file. It will be auto-generated if not provided.
/// "z9RV14K95DvU.png"
#[serde(skip_serializing_if = "Option::is_none")]
pub file_name: Option<String>,
/// The size of the file in bytes.
/// 4404019
#[serde(skip_serializing_if = "Option::is_none")]
pub file_size: Option<i64>,
/// The URL where the file can be downloaded from.
pub url: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct HTTPValidationError {
#[serde(skip_serializing_if = "Option::is_none")]
pub detail: Option<Vec<Option<ValidationError>>>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ValidationError {
pub loc: Vec<serde_json::Value>,
pub msg: String,
#[serde(rename = "type")]
pub ty: String,
}
/// Eye Correct
///
/// Category: video-to-video
/// Machine Type: A100
pub fn eye_correct(params: EyeCorrectInput) -> FalRequest<EyeCorrectInput, EyeCorrectOutput> {
FalRequest::new("fal-ai/eye-correct", params)
}
+74
View File
@@ -0,0 +1,74 @@
#[allow(unused_imports)]
use crate::prelude::*;
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::collections::HashMap;
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct AudioFile {
#[serde(skip_serializing_if = "Option::is_none")]
pub content_type: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub file_name: Option<String>,
/// The size of the file in bytes.
/// 4404019
#[serde(skip_serializing_if = "Option::is_none")]
pub file_size: Option<FileSizeProperty>,
pub url: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct HTTPValidationError {
#[serde(skip_serializing_if = "Option::is_none")]
pub detail: Option<Vec<Option<ValidationError>>>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct TTSInput {
/// The text to be converted to speech.
/// "I don't really care what you call me. I've been a silent spectator, watching species evolve, empires rise and fall. But always remember, I am mighty and enduring. Respect me and I'll nurture you; ignore me and you shall face the consequences."
pub gen_text: String,
/// The name of the model to be used for TTS.
pub model_type: String,
/// The URL of the reference audio file.
/// "https://github.com/SWivid/F5-TTS/raw/21900ba97d5020a5a70bcc9a0575dc7dec5021cb/tests/ref_audio/test_en_1_ref_short.wav"
pub ref_audio_url: String,
/// The reference text to be used for TTS. If not provided, an ASR (Automatic Speech Recognition) model will be used to generate the reference text.
/// "Some call me nature, others call me mother nature."
#[serde(skip_serializing_if = "Option::is_none")]
pub ref_text: Option<String>,
/// Whether to remove the silence from the audio file.
#[serde(skip_serializing_if = "Option::is_none")]
pub remove_silence: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct TTSOutput {
/// The audio file containing the generated speech.
pub audio_url: AudioFile,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ValidationError {
pub loc: Vec<serde_json::Value>,
pub msg: String,
#[serde(rename = "type")]
pub ty: String,
}
#[derive(Debug, Serialize, Deserialize, smart_default::SmartDefault)]
#[allow(non_camel_case_types)]
pub enum FileSizeProperty {
#[default]
Integer(i64),
Null(serde_json::Value),
}
/// F5 TTS
///
/// Category: text-to-audio
/// Machine Type: A100
pub fn f5_tts(params: TTSInput) -> FalRequest<TTSInput, TTSOutput> {
FalRequest::new("fal-ai/f5-tts", params)
}
@@ -0,0 +1,164 @@
#[allow(unused_imports)]
use crate::prelude::*;
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::collections::HashMap;
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct FaceToStickerInput {
/// If set to false, the safety checker will be disabled.
#[serde(skip_serializing_if = "Option::is_none")]
pub enable_safety_checker: Option<bool>,
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want
/// the model to stick to your prompt when looking for a related image to show you.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance_scale: Option<f64>,
/// The size of the generated image.
#[serde(skip_serializing_if = "Option::is_none")]
pub image_size: Option<ImageSizeProperty>,
/// URL of the video.
/// "https://storage.googleapis.com/falserverless/model_tests/face_to_sticker/elon.jpg"
pub image_url: String,
/// The strength of the instant ID.
#[serde(skip_serializing_if = "Option::is_none")]
pub instant_id_strength: Option<f64>,
/// The amount of noise to add to the IP adapter.
#[serde(skip_serializing_if = "Option::is_none")]
pub ip_adapter_noise: Option<f64>,
/// The weight of the IP adapter.
#[serde(skip_serializing_if = "Option::is_none")]
pub ip_adapter_weight: Option<f64>,
/// The negative prompt to use. Use it to address details that you don't want
/// in the image. This could be colors, objects, scenery and even the small details
/// (e.g. moustache, blurry, low resolution).
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// Increasing the amount of steps tells Stable Diffusion that it should take more steps
/// to generate your final result which can increase the amount of detail in your image.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// The prompt to use for generating the image. Be as descriptive as possible for best results.
/// "a person"
pub prompt: String,
/// The same seed and the same prompt given to the same version of Stable Diffusion
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// Whether to upscale the image 2x.
#[serde(skip_serializing_if = "Option::is_none")]
pub upscale: Option<bool>,
/// The number of steps to use for upscaling. Only used if `upscale` is `true`.
#[serde(skip_serializing_if = "Option::is_none")]
pub upscale_steps: Option<i64>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct FaceToStickerOutput {
/// Whether the generated images contain NSFW concepts.
/// The key is the image type and the value is a boolean.
/// {"sticker_image":false,"sticker_image_background_removed":false}
pub has_nsfw_concepts: HasNsfwConcepts,
/// The generated images.
/// [{"content_type":"image/PNG","file_name":"cd8bab71b946470099d5fa20c7eed440.png","file_size":560358,"height":1024,"url":"https://storage.googleapis.com/falserverless/model_tests/face_to_sticker/elon_output_1.png","width":1024},{"content_type":"image/PNG","file_name":"181ae8fa12534c6f9285a991b415d9a7.png","file_size":452906,"height":1024,"url":"https://storage.googleapis.com/falserverless/model_tests/face_to_sticker/elon_output_2.png","width":1024}]
pub images: Vec<Image>,
/// Seed used during the inference.
/// 3625437076
pub seed: i64,
/// The generated face sticker image.
/// {"content_type":"image/PNG","file_name":"cd8bab71b946470099d5fa20c7eed440.png","file_size":560358,"height":1024,"url":"https://storage.googleapis.com/falserverless/model_tests/face_to_sticker/elon_output_1.png","width":1024}
pub sticker_image: Image,
/// The generated face sticker image with the background removed.
/// {"content_type":"image/PNG","file_name":"181ae8fa12534c6f9285a991b415d9a7.png","file_size":452906,"height":1024,"url":"https://storage.googleapis.com/falserverless/model_tests/face_to_sticker/elon_output_2.png","width":1024}
pub sticker_image_background_removed: Image,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct HTTPValidationError {
#[serde(skip_serializing_if = "Option::is_none")]
pub detail: Option<Vec<Option<ValidationError>>>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Image {
/// The mime type of the file.
/// "image/png"
#[serde(skip_serializing_if = "Option::is_none")]
pub content_type: Option<String>,
/// File data
#[serde(skip_serializing_if = "Option::is_none")]
pub file_data: Option<String>,
/// The name of the file. It will be auto-generated if not provided.
/// "z9RV14K95DvU.png"
#[serde(skip_serializing_if = "Option::is_none")]
pub file_name: Option<String>,
/// The size of the file in bytes.
/// 4404019
#[serde(skip_serializing_if = "Option::is_none")]
pub file_size: Option<i64>,
/// The height of the image in pixels.
/// 1024
#[serde(skip_serializing_if = "Option::is_none")]
pub height: Option<i64>,
/// The URL where the file can be downloaded from.
pub url: String,
/// The width of the image in pixels.
/// 1024
#[serde(skip_serializing_if = "Option::is_none")]
pub width: Option<i64>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ImageSize {
/// The height of the generated image.
#[serde(skip_serializing_if = "Option::is_none")]
pub height: Option<i64>,
/// The width of the generated image.
#[serde(skip_serializing_if = "Option::is_none")]
pub width: Option<i64>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ValidationError {
pub loc: Vec<serde_json::Value>,
pub msg: String,
#[serde(rename = "type")]
pub ty: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct HasNsfwConcepts {
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(rename = "type")]
pub ty: Option<serde_json::Value>,
}
#[derive(Debug, Serialize, Deserialize, smart_default::SmartDefault)]
#[allow(non_camel_case_types)]
pub enum ImageSizeProperty {
#[default]
ImageSize(ImageSize),
#[serde(rename = "square_hd")]
SquareHd,
#[serde(rename = "square")]
Square,
#[serde(rename = "portrait_4_3")]
Portrait43,
#[serde(rename = "portrait_16_9")]
Portrait169,
#[serde(rename = "landscape_4_3")]
Landscape43,
#[serde(rename = "landscape_16_9")]
Landscape169,
}
/// Face to Sticker
///
/// Category: image-to-image
/// Machine Type: A100
/// License Type: research
pub fn face_to_sticker(
params: FaceToStickerInput,
) -> FalRequest<FaceToStickerInput, FaceToStickerOutput> {
FalRequest::new("fal-ai/face-to-sticker", params)
}
@@ -0,0 +1,42 @@
#[cfg(any(
feature = "endpoints",
feature = "endpoints_fal-ai",
feature = "endpoints_fal-ai_fast-animatediff"
))]
#[cfg_attr(
docsrs,
doc(cfg(any(
feature = "endpoints",
feature = "endpoints_fal-ai",
feature = "endpoints_fal-ai_fast-animatediff"
)))
)]
pub mod text_to_video;
#[cfg(any(
feature = "endpoints",
feature = "endpoints_fal-ai",
feature = "endpoints_fal-ai_fast-animatediff"
))]
#[cfg_attr(
docsrs,
doc(cfg(any(
feature = "endpoints",
feature = "endpoints_fal-ai",
feature = "endpoints_fal-ai_fast-animatediff"
)))
)]
pub mod turbo;
#[cfg(any(
feature = "endpoints",
feature = "endpoints_fal-ai",
feature = "endpoints_fal-ai_fast-animatediff"
))]
#[cfg_attr(
docsrs,
doc(cfg(any(
feature = "endpoints",
feature = "endpoints_fal-ai",
feature = "endpoints_fal-ai_fast-animatediff"
)))
)]
pub mod video_to_video;
@@ -0,0 +1,245 @@
#[allow(unused_imports)]
use crate::prelude::*;
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::collections::HashMap;
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct AnimateDiffT2VInput {
/// Number of frames per second to extract from the video.
#[serde(skip_serializing_if = "Option::is_none")]
pub fps: Option<i64>,
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want
/// the model to stick to your prompt when looking for a related image to show you.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance_scale: Option<f64>,
/// The motions to apply to the video.
#[serde(skip_serializing_if = "Option::is_none")]
pub motions: Option<Vec<Option<String>>>,
/// The negative prompt to use. Use it to address details that you don't want
/// in the image. This could be colors, objects, scenery and even the small details
/// (e.g. moustache, blurry, low resolution).
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// The number of frames to generate for the video.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_frames: Option<i64>,
/// The number of inference steps to perform.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// The prompt to use for generating the video. Be as descriptive as possible for best results.
/// "masterpiece, best quality, 1girl, solo, cherry blossoms, hanami, pink flower, white flower, spring season, wisteria, petals, flower, plum blossoms, outdoors, falling petals, white hair, black eyes"
/// "panda playing a guitar, on a boat, in the ocean, high quality, high quality, ultra HD, realistic"
pub prompt: String,
/// The same seed and the same prompt given to the same version of Stable Diffusion
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// The size of the video to generate.
#[serde(skip_serializing_if = "Option::is_none")]
pub video_size: Option<VideoSizeProperty>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct AnimateDiffT2VOutput {
/// Seed used for generating the video.
pub seed: i64,
/// Generated video file.
/// {"url":"https://fal-cdn.batuhan-941.workers.dev/files/kangaroo/DSrFBOk9XXIplm_kukI4n.mp4"}
pub video: File,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct AnimateDiffT2VTurboInput {
/// Number of frames per second to extract from the video.
#[serde(skip_serializing_if = "Option::is_none")]
pub fps: Option<i64>,
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want the model to stick to your prompt when looking for a related image to show you.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance_scale: Option<f64>,
/// The motions to apply to the video.
#[serde(skip_serializing_if = "Option::is_none")]
pub motions: Option<Vec<Option<String>>>,
/// The negative prompt to use. Use it to address details that you don't want
/// in the image. This could be colors, objects, scenery and even the small details
/// (e.g. moustache, blurry, low resolution).
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// The number of frames to generate for the video.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_frames: Option<i64>,
/// The number of inference steps to perform. 4-12 is recommended for turbo mode.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// The prompt to use for generating the video. Be as descriptive as possible for best results.
/// "masterpiece, best quality, 1girl, solo, cherry blossoms, hanami, pink flower, white flower, spring season, wisteria, petals, flower, plum blossoms, outdoors, falling petals, white hair, black eyes"
/// "panda playing a guitar, on a boat, in the ocean, high quality, high quality, ultra HD, realistic"
pub prompt: String,
/// The same seed and the same prompt given to the same version of Stable Diffusion
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// The size of the video to generate.
#[serde(skip_serializing_if = "Option::is_none")]
pub video_size: Option<VideoSizeProperty>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct AnimateDiffV2VInput {
/// The first N number of seconds of video to animate.
#[serde(skip_serializing_if = "Option::is_none")]
pub first_n_seconds: Option<i64>,
/// Number of frames per second to extract from the video.
#[serde(skip_serializing_if = "Option::is_none")]
pub fps: Option<i64>,
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want
/// the model to stick to your prompt when looking for a related image to show you.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance_scale: Option<f64>,
/// The motions to apply to the video.
#[serde(skip_serializing_if = "Option::is_none")]
pub motions: Option<Vec<Option<String>>>,
/// The negative prompt to use. Use it to address details that you don't want
/// in the image. This could be colors, objects, scenery and even the small details
/// (e.g. moustache, blurry, low resolution).
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// The number of inference steps to perform.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// The prompt to use for generating the image. Be as descriptive as possible for best results.
/// "closeup of tony stark, robert downey jr, fireworks, high quality, ultra HD"
/// "panda playing a guitar, on a boat, in the ocean, high quality, high quality, ultra HD, realistic"
pub prompt: String,
/// The same seed and the same prompt given to the same version of Stable Diffusion
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// The strength of the input video in the final output.
#[serde(skip_serializing_if = "Option::is_none")]
pub strength: Option<f64>,
/// URL of the video.
/// "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/animatediff-vid2vid-input-2.gif"
/// "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/animatediff-vid2vid-input-1.gif"
pub video_url: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct AnimateDiffV2VOutput {
/// Seed used for generating the video.
pub seed: i64,
/// Generated video file.
/// {"url":"https://fal-cdn.batuhan-941.workers.dev/files/koala/5Cb_6P_s9wW8f8-g9c4yj.mp4"}
pub video: File,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct AnimateDiffV2VTurboInput {
/// The first N number of seconds of video to animate.
#[serde(skip_serializing_if = "Option::is_none")]
pub first_n_seconds: Option<i64>,
/// Number of frames per second to extract from the video.
#[serde(skip_serializing_if = "Option::is_none")]
pub fps: Option<i64>,
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want the model to stick to your prompt when looking for a related image to show you.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance_scale: Option<f64>,
/// The motions to apply to the video.
#[serde(skip_serializing_if = "Option::is_none")]
pub motions: Option<Vec<Option<String>>>,
/// The negative prompt to use. Use it to address details that you don't want
/// in the image. This could be colors, objects, scenery and even the small details
/// (e.g. moustache, blurry, low resolution).
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// The number of inference steps to perform. 4-12 is recommended for turbo mode.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// The prompt to use for generating the image. Be as descriptive as possible for best results.
/// "closeup of tony stark, robert downey jr, fireworks, high quality, ultra HD"
/// "panda playing a guitar, on a boat, in the ocean, high quality, high quality, ultra HD, realistic"
pub prompt: String,
/// The same seed and the same prompt given to the same version of Stable Diffusion
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// The strength of the input video in the final output.
#[serde(skip_serializing_if = "Option::is_none")]
pub strength: Option<f64>,
/// URL of the video.
/// "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/animatediff-vid2vid-input-2.gif"
/// "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/animatediff-vid2vid-input-1.gif"
pub video_url: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct File {
/// The mime type of the file.
/// "image/png"
#[serde(skip_serializing_if = "Option::is_none")]
pub content_type: Option<String>,
/// The name of the file. It will be auto-generated if not provided.
/// "z9RV14K95DvU.png"
#[serde(skip_serializing_if = "Option::is_none")]
pub file_name: Option<String>,
/// The size of the file in bytes.
/// 4404019
#[serde(skip_serializing_if = "Option::is_none")]
pub file_size: Option<i64>,
/// The URL where the file can be downloaded from.
pub url: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct HTTPValidationError {
#[serde(skip_serializing_if = "Option::is_none")]
pub detail: Option<Vec<Option<ValidationError>>>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ImageSize {
/// The height of the generated image.
#[serde(skip_serializing_if = "Option::is_none")]
pub height: Option<i64>,
/// The width of the generated image.
#[serde(skip_serializing_if = "Option::is_none")]
pub width: Option<i64>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ValidationError {
pub loc: Vec<serde_json::Value>,
pub msg: String,
#[serde(rename = "type")]
pub ty: String,
}
#[derive(Debug, Serialize, Deserialize, smart_default::SmartDefault)]
#[allow(non_camel_case_types)]
pub enum VideoSizeProperty {
#[default]
ImageSize(ImageSize),
#[serde(rename = "square_hd")]
SquareHd,
#[serde(rename = "square")]
Square,
#[serde(rename = "portrait_4_3")]
Portrait43,
#[serde(rename = "portrait_16_9")]
Portrait169,
#[serde(rename = "landscape_4_3")]
Landscape43,
#[serde(rename = "landscape_16_9")]
Landscape169,
}
/// AnimateDiff
///
/// Category: text-to-video
/// Machine Type: A100
pub fn text_to_video(
params: AnimateDiffT2VInput,
) -> FalRequest<AnimateDiffT2VInput, AnimateDiffT2VOutput> {
FalRequest::new("fal-ai/fast-animatediff/text-to-video", params)
}
@@ -0,0 +1,28 @@
#[cfg(any(
feature = "endpoints",
feature = "endpoints_fal-ai",
feature = "endpoints_fal-ai_fast-animatediff"
))]
#[cfg_attr(
docsrs,
doc(cfg(any(
feature = "endpoints",
feature = "endpoints_fal-ai",
feature = "endpoints_fal-ai_fast-animatediff"
)))
)]
pub mod text_to_video;
#[cfg(any(
feature = "endpoints",
feature = "endpoints_fal-ai",
feature = "endpoints_fal-ai_fast-animatediff"
))]
#[cfg_attr(
docsrs,
doc(cfg(any(
feature = "endpoints",
feature = "endpoints_fal-ai",
feature = "endpoints_fal-ai_fast-animatediff"
)))
)]
pub mod video_to_video;
@@ -0,0 +1,245 @@
#[allow(unused_imports)]
use crate::prelude::*;
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::collections::HashMap;
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct AnimateDiffT2VInput {
/// Number of frames per second to extract from the video.
#[serde(skip_serializing_if = "Option::is_none")]
pub fps: Option<i64>,
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want
/// the model to stick to your prompt when looking for a related image to show you.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance_scale: Option<f64>,
/// The motions to apply to the video.
#[serde(skip_serializing_if = "Option::is_none")]
pub motions: Option<Vec<Option<String>>>,
/// The negative prompt to use. Use it to address details that you don't want
/// in the image. This could be colors, objects, scenery and even the small details
/// (e.g. moustache, blurry, low resolution).
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// The number of frames to generate for the video.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_frames: Option<i64>,
/// The number of inference steps to perform.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// The prompt to use for generating the video. Be as descriptive as possible for best results.
/// "masterpiece, best quality, 1girl, solo, cherry blossoms, hanami, pink flower, white flower, spring season, wisteria, petals, flower, plum blossoms, outdoors, falling petals, white hair, black eyes"
/// "panda playing a guitar, on a boat, in the ocean, high quality, high quality, ultra HD, realistic"
pub prompt: String,
/// The same seed and the same prompt given to the same version of Stable Diffusion
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// The size of the video to generate.
#[serde(skip_serializing_if = "Option::is_none")]
pub video_size: Option<VideoSizeProperty>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct AnimateDiffT2VOutput {
/// Seed used for generating the video.
pub seed: i64,
/// Generated video file.
/// {"url":"https://fal-cdn.batuhan-941.workers.dev/files/kangaroo/DSrFBOk9XXIplm_kukI4n.mp4"}
pub video: File,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct AnimateDiffT2VTurboInput {
/// Number of frames per second to extract from the video.
#[serde(skip_serializing_if = "Option::is_none")]
pub fps: Option<i64>,
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want the model to stick to your prompt when looking for a related image to show you.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance_scale: Option<f64>,
/// The motions to apply to the video.
#[serde(skip_serializing_if = "Option::is_none")]
pub motions: Option<Vec<Option<String>>>,
/// The negative prompt to use. Use it to address details that you don't want
/// in the image. This could be colors, objects, scenery and even the small details
/// (e.g. moustache, blurry, low resolution).
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// The number of frames to generate for the video.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_frames: Option<i64>,
/// The number of inference steps to perform. 4-12 is recommended for turbo mode.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// The prompt to use for generating the video. Be as descriptive as possible for best results.
/// "masterpiece, best quality, 1girl, solo, cherry blossoms, hanami, pink flower, white flower, spring season, wisteria, petals, flower, plum blossoms, outdoors, falling petals, white hair, black eyes"
/// "panda playing a guitar, on a boat, in the ocean, high quality, high quality, ultra HD, realistic"
pub prompt: String,
/// The same seed and the same prompt given to the same version of Stable Diffusion
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// The size of the video to generate.
#[serde(skip_serializing_if = "Option::is_none")]
pub video_size: Option<VideoSizeProperty>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct AnimateDiffV2VInput {
/// The first N number of seconds of video to animate.
#[serde(skip_serializing_if = "Option::is_none")]
pub first_n_seconds: Option<i64>,
/// Number of frames per second to extract from the video.
#[serde(skip_serializing_if = "Option::is_none")]
pub fps: Option<i64>,
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want
/// the model to stick to your prompt when looking for a related image to show you.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance_scale: Option<f64>,
/// The motions to apply to the video.
#[serde(skip_serializing_if = "Option::is_none")]
pub motions: Option<Vec<Option<String>>>,
/// The negative prompt to use. Use it to address details that you don't want
/// in the image. This could be colors, objects, scenery and even the small details
/// (e.g. moustache, blurry, low resolution).
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// The number of inference steps to perform.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// The prompt to use for generating the image. Be as descriptive as possible for best results.
/// "closeup of tony stark, robert downey jr, fireworks, high quality, ultra HD"
/// "panda playing a guitar, on a boat, in the ocean, high quality, high quality, ultra HD, realistic"
pub prompt: String,
/// The same seed and the same prompt given to the same version of Stable Diffusion
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// The strength of the input video in the final output.
#[serde(skip_serializing_if = "Option::is_none")]
pub strength: Option<f64>,
/// URL of the video.
/// "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/animatediff-vid2vid-input-2.gif"
/// "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/animatediff-vid2vid-input-1.gif"
pub video_url: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct AnimateDiffV2VOutput {
/// Seed used for generating the video.
pub seed: i64,
/// Generated video file.
/// {"url":"https://fal-cdn.batuhan-941.workers.dev/files/koala/5Cb_6P_s9wW8f8-g9c4yj.mp4"}
pub video: File,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct AnimateDiffV2VTurboInput {
/// The first N number of seconds of video to animate.
#[serde(skip_serializing_if = "Option::is_none")]
pub first_n_seconds: Option<i64>,
/// Number of frames per second to extract from the video.
#[serde(skip_serializing_if = "Option::is_none")]
pub fps: Option<i64>,
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want the model to stick to your prompt when looking for a related image to show you.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance_scale: Option<f64>,
/// The motions to apply to the video.
#[serde(skip_serializing_if = "Option::is_none")]
pub motions: Option<Vec<Option<String>>>,
/// The negative prompt to use. Use it to address details that you don't want
/// in the image. This could be colors, objects, scenery and even the small details
/// (e.g. moustache, blurry, low resolution).
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// The number of inference steps to perform. 4-12 is recommended for turbo mode.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// The prompt to use for generating the image. Be as descriptive as possible for best results.
/// "closeup of tony stark, robert downey jr, fireworks, high quality, ultra HD"
/// "panda playing a guitar, on a boat, in the ocean, high quality, high quality, ultra HD, realistic"
pub prompt: String,
/// The same seed and the same prompt given to the same version of Stable Diffusion
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// The strength of the input video in the final output.
#[serde(skip_serializing_if = "Option::is_none")]
pub strength: Option<f64>,
/// URL of the video.
/// "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/animatediff-vid2vid-input-2.gif"
/// "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/animatediff-vid2vid-input-1.gif"
pub video_url: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct File {
/// The mime type of the file.
/// "image/png"
#[serde(skip_serializing_if = "Option::is_none")]
pub content_type: Option<String>,
/// The name of the file. It will be auto-generated if not provided.
/// "z9RV14K95DvU.png"
#[serde(skip_serializing_if = "Option::is_none")]
pub file_name: Option<String>,
/// The size of the file in bytes.
/// 4404019
#[serde(skip_serializing_if = "Option::is_none")]
pub file_size: Option<i64>,
/// The URL where the file can be downloaded from.
pub url: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct HTTPValidationError {
#[serde(skip_serializing_if = "Option::is_none")]
pub detail: Option<Vec<Option<ValidationError>>>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ImageSize {
/// The height of the generated image.
#[serde(skip_serializing_if = "Option::is_none")]
pub height: Option<i64>,
/// The width of the generated image.
#[serde(skip_serializing_if = "Option::is_none")]
pub width: Option<i64>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ValidationError {
pub loc: Vec<serde_json::Value>,
pub msg: String,
#[serde(rename = "type")]
pub ty: String,
}
#[derive(Debug, Serialize, Deserialize, smart_default::SmartDefault)]
#[allow(non_camel_case_types)]
pub enum VideoSizeProperty {
#[default]
ImageSize(ImageSize),
#[serde(rename = "square_hd")]
SquareHd,
#[serde(rename = "square")]
Square,
#[serde(rename = "portrait_4_3")]
Portrait43,
#[serde(rename = "portrait_16_9")]
Portrait169,
#[serde(rename = "landscape_4_3")]
Landscape43,
#[serde(rename = "landscape_16_9")]
Landscape169,
}
/// AnimateDiff
///
/// Category: text-to-video
/// Machine Type: A100
pub fn text_to_video(
params: AnimateDiffT2VTurboInput,
) -> FalRequest<AnimateDiffT2VTurboInput, AnimateDiffT2VOutput> {
FalRequest::new("fal-ai/fast-animatediff/turbo/text-to-video", params)
}
@@ -0,0 +1,245 @@
#[allow(unused_imports)]
use crate::prelude::*;
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::collections::HashMap;
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct AnimateDiffT2VInput {
/// Number of frames per second to extract from the video.
#[serde(skip_serializing_if = "Option::is_none")]
pub fps: Option<i64>,
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want
/// the model to stick to your prompt when looking for a related image to show you.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance_scale: Option<f64>,
/// The motions to apply to the video.
#[serde(skip_serializing_if = "Option::is_none")]
pub motions: Option<Vec<Option<String>>>,
/// The negative prompt to use. Use it to address details that you don't want
/// in the image. This could be colors, objects, scenery and even the small details
/// (e.g. moustache, blurry, low resolution).
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// The number of frames to generate for the video.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_frames: Option<i64>,
/// The number of inference steps to perform.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// The prompt to use for generating the video. Be as descriptive as possible for best results.
/// "masterpiece, best quality, 1girl, solo, cherry blossoms, hanami, pink flower, white flower, spring season, wisteria, petals, flower, plum blossoms, outdoors, falling petals, white hair, black eyes"
/// "panda playing a guitar, on a boat, in the ocean, high quality, high quality, ultra HD, realistic"
pub prompt: String,
/// The same seed and the same prompt given to the same version of Stable Diffusion
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// The size of the video to generate.
#[serde(skip_serializing_if = "Option::is_none")]
pub video_size: Option<VideoSizeProperty>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct AnimateDiffT2VOutput {
/// Seed used for generating the video.
pub seed: i64,
/// Generated video file.
/// {"url":"https://fal-cdn.batuhan-941.workers.dev/files/kangaroo/DSrFBOk9XXIplm_kukI4n.mp4"}
pub video: File,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct AnimateDiffT2VTurboInput {
/// Number of frames per second to extract from the video.
#[serde(skip_serializing_if = "Option::is_none")]
pub fps: Option<i64>,
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want the model to stick to your prompt when looking for a related image to show you.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance_scale: Option<f64>,
/// The motions to apply to the video.
#[serde(skip_serializing_if = "Option::is_none")]
pub motions: Option<Vec<Option<String>>>,
/// The negative prompt to use. Use it to address details that you don't want
/// in the image. This could be colors, objects, scenery and even the small details
/// (e.g. moustache, blurry, low resolution).
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// The number of frames to generate for the video.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_frames: Option<i64>,
/// The number of inference steps to perform. 4-12 is recommended for turbo mode.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// The prompt to use for generating the video. Be as descriptive as possible for best results.
/// "masterpiece, best quality, 1girl, solo, cherry blossoms, hanami, pink flower, white flower, spring season, wisteria, petals, flower, plum blossoms, outdoors, falling petals, white hair, black eyes"
/// "panda playing a guitar, on a boat, in the ocean, high quality, high quality, ultra HD, realistic"
pub prompt: String,
/// The same seed and the same prompt given to the same version of Stable Diffusion
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// The size of the video to generate.
#[serde(skip_serializing_if = "Option::is_none")]
pub video_size: Option<VideoSizeProperty>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct AnimateDiffV2VInput {
/// The first N number of seconds of video to animate.
#[serde(skip_serializing_if = "Option::is_none")]
pub first_n_seconds: Option<i64>,
/// Number of frames per second to extract from the video.
#[serde(skip_serializing_if = "Option::is_none")]
pub fps: Option<i64>,
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want
/// the model to stick to your prompt when looking for a related image to show you.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance_scale: Option<f64>,
/// The motions to apply to the video.
#[serde(skip_serializing_if = "Option::is_none")]
pub motions: Option<Vec<Option<String>>>,
/// The negative prompt to use. Use it to address details that you don't want
/// in the image. This could be colors, objects, scenery and even the small details
/// (e.g. moustache, blurry, low resolution).
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// The number of inference steps to perform.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// The prompt to use for generating the image. Be as descriptive as possible for best results.
/// "closeup of tony stark, robert downey jr, fireworks, high quality, ultra HD"
/// "panda playing a guitar, on a boat, in the ocean, high quality, high quality, ultra HD, realistic"
pub prompt: String,
/// The same seed and the same prompt given to the same version of Stable Diffusion
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// The strength of the input video in the final output.
#[serde(skip_serializing_if = "Option::is_none")]
pub strength: Option<f64>,
/// URL of the video.
/// "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/animatediff-vid2vid-input-2.gif"
/// "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/animatediff-vid2vid-input-1.gif"
pub video_url: String,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct AnimateDiffV2VOutput {
/// Seed used for generating the video.
pub seed: i64,
/// Generated video file.
/// {"url":"https://fal-cdn.batuhan-941.workers.dev/files/koala/5Cb_6P_s9wW8f8-g9c4yj.mp4"}
pub video: File,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct AnimateDiffV2VTurboInput {
/// The first N number of seconds of video to animate.
#[serde(skip_serializing_if = "Option::is_none")]
pub first_n_seconds: Option<i64>,
/// Number of frames per second to extract from the video.
#[serde(skip_serializing_if = "Option::is_none")]
pub fps: Option<i64>,
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want the model to stick to your prompt when looking for a related image to show you.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance_scale: Option<f64>,
/// The motions to apply to the video.
#[serde(skip_serializing_if = "Option::is_none")]
pub motions: Option<Vec<Option<String>>>,
/// The negative prompt to use. Use it to address details that you don't want
/// in the image. This could be colors, objects, scenery and even the small details
/// (e.g. moustache, blurry, low resolution).
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// The number of inference steps to perform. 4-12 is recommended for turbo mode.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// The prompt to use for generating the image. Be as descriptive as possible for best results.
/// "closeup of tony stark, robert downey jr, fireworks, high quality, ultra HD"
/// "panda playing a guitar, on a boat, in the ocean, high quality, high quality, ultra HD, realistic"
pub prompt: String,
/// The same seed and the same prompt given to the same version of Stable Diffusion
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// The strength of the input video in the final output.
#[serde(skip_serializing_if = "Option::is_none")]
pub strength: Option<f64>,
/// URL of the video.
/// "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/animatediff-vid2vid-input-2.gif"
/// "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/animatediff-vid2vid-input-1.gif"
pub video_url: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct File {
/// The mime type of the file.
/// "image/png"
#[serde(skip_serializing_if = "Option::is_none")]
pub content_type: Option<String>,
/// The name of the file. It will be auto-generated if not provided.
/// "z9RV14K95DvU.png"
#[serde(skip_serializing_if = "Option::is_none")]
pub file_name: Option<String>,
/// The size of the file in bytes.
/// 4404019
#[serde(skip_serializing_if = "Option::is_none")]
pub file_size: Option<i64>,
/// The URL where the file can be downloaded from.
pub url: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct HTTPValidationError {
#[serde(skip_serializing_if = "Option::is_none")]
pub detail: Option<Vec<Option<ValidationError>>>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ImageSize {
/// The height of the generated image.
#[serde(skip_serializing_if = "Option::is_none")]
pub height: Option<i64>,
/// The width of the generated image.
#[serde(skip_serializing_if = "Option::is_none")]
pub width: Option<i64>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ValidationError {
pub loc: Vec<serde_json::Value>,
pub msg: String,
#[serde(rename = "type")]
pub ty: String,
}
#[derive(Debug, Serialize, Deserialize, smart_default::SmartDefault)]
#[allow(non_camel_case_types)]
pub enum VideoSizeProperty {
#[default]
ImageSize(ImageSize),
#[serde(rename = "square_hd")]
SquareHd,
#[serde(rename = "square")]
Square,
#[serde(rename = "portrait_4_3")]
Portrait43,
#[serde(rename = "portrait_16_9")]
Portrait169,
#[serde(rename = "landscape_4_3")]
Landscape43,
#[serde(rename = "landscape_16_9")]
Landscape169,
}
/// AnimateDiff
///
/// Category: text-to-video
/// Machine Type: A100
pub fn video_to_video(
params: AnimateDiffV2VTurboInput,
) -> FalRequest<AnimateDiffV2VTurboInput, AnimateDiffV2VOutput> {
FalRequest::new("fal-ai/fast-animatediff/turbo/video-to-video", params)
}
@@ -0,0 +1,245 @@
#[allow(unused_imports)]
use crate::prelude::*;
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::collections::HashMap;
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct AnimateDiffT2VInput {
/// Number of frames per second to extract from the video.
#[serde(skip_serializing_if = "Option::is_none")]
pub fps: Option<i64>,
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want
/// the model to stick to your prompt when looking for a related image to show you.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance_scale: Option<f64>,
/// The motions to apply to the video.
#[serde(skip_serializing_if = "Option::is_none")]
pub motions: Option<Vec<Option<String>>>,
/// The negative prompt to use. Use it to address details that you don't want
/// in the image. This could be colors, objects, scenery and even the small details
/// (e.g. moustache, blurry, low resolution).
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// The number of frames to generate for the video.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_frames: Option<i64>,
/// The number of inference steps to perform.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// The prompt to use for generating the video. Be as descriptive as possible for best results.
/// "masterpiece, best quality, 1girl, solo, cherry blossoms, hanami, pink flower, white flower, spring season, wisteria, petals, flower, plum blossoms, outdoors, falling petals, white hair, black eyes"
/// "panda playing a guitar, on a boat, in the ocean, high quality, high quality, ultra HD, realistic"
pub prompt: String,
/// The same seed and the same prompt given to the same version of Stable Diffusion
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// The size of the video to generate.
#[serde(skip_serializing_if = "Option::is_none")]
pub video_size: Option<VideoSizeProperty>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct AnimateDiffT2VOutput {
/// Seed used for generating the video.
pub seed: i64,
/// Generated video file.
/// {"url":"https://fal-cdn.batuhan-941.workers.dev/files/kangaroo/DSrFBOk9XXIplm_kukI4n.mp4"}
pub video: File,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct AnimateDiffT2VTurboInput {
/// Number of frames per second to extract from the video.
#[serde(skip_serializing_if = "Option::is_none")]
pub fps: Option<i64>,
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want the model to stick to your prompt when looking for a related image to show you.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance_scale: Option<f64>,
/// The motions to apply to the video.
#[serde(skip_serializing_if = "Option::is_none")]
pub motions: Option<Vec<Option<String>>>,
/// The negative prompt to use. Use it to address details that you don't want
/// in the image. This could be colors, objects, scenery and even the small details
/// (e.g. moustache, blurry, low resolution).
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// The number of frames to generate for the video.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_frames: Option<i64>,
/// The number of inference steps to perform. 4-12 is recommended for turbo mode.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// The prompt to use for generating the video. Be as descriptive as possible for best results.
/// "masterpiece, best quality, 1girl, solo, cherry blossoms, hanami, pink flower, white flower, spring season, wisteria, petals, flower, plum blossoms, outdoors, falling petals, white hair, black eyes"
/// "panda playing a guitar, on a boat, in the ocean, high quality, high quality, ultra HD, realistic"
pub prompt: String,
/// The same seed and the same prompt given to the same version of Stable Diffusion
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// The size of the video to generate.
#[serde(skip_serializing_if = "Option::is_none")]
pub video_size: Option<VideoSizeProperty>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct AnimateDiffV2VInput {
/// The first N number of seconds of video to animate.
#[serde(skip_serializing_if = "Option::is_none")]
pub first_n_seconds: Option<i64>,
/// Number of frames per second to extract from the video.
#[serde(skip_serializing_if = "Option::is_none")]
pub fps: Option<i64>,
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want
/// the model to stick to your prompt when looking for a related image to show you.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance_scale: Option<f64>,
/// The motions to apply to the video.
#[serde(skip_serializing_if = "Option::is_none")]
pub motions: Option<Vec<Option<String>>>,
/// The negative prompt to use. Use it to address details that you don't want
/// in the image. This could be colors, objects, scenery and even the small details
/// (e.g. moustache, blurry, low resolution).
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// The number of inference steps to perform.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// The prompt to use for generating the image. Be as descriptive as possible for best results.
/// "closeup of tony stark, robert downey jr, fireworks, high quality, ultra HD"
/// "panda playing a guitar, on a boat, in the ocean, high quality, high quality, ultra HD, realistic"
pub prompt: String,
/// The same seed and the same prompt given to the same version of Stable Diffusion
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// The strength of the input video in the final output.
#[serde(skip_serializing_if = "Option::is_none")]
pub strength: Option<f64>,
/// URL of the video.
/// "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/animatediff-vid2vid-input-2.gif"
/// "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/animatediff-vid2vid-input-1.gif"
pub video_url: String,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct AnimateDiffV2VOutput {
/// Seed used for generating the video.
pub seed: i64,
/// Generated video file.
/// {"url":"https://fal-cdn.batuhan-941.workers.dev/files/koala/5Cb_6P_s9wW8f8-g9c4yj.mp4"}
pub video: File,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct AnimateDiffV2VTurboInput {
/// The first N number of seconds of video to animate.
#[serde(skip_serializing_if = "Option::is_none")]
pub first_n_seconds: Option<i64>,
/// Number of frames per second to extract from the video.
#[serde(skip_serializing_if = "Option::is_none")]
pub fps: Option<i64>,
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want the model to stick to your prompt when looking for a related image to show you.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance_scale: Option<f64>,
/// The motions to apply to the video.
#[serde(skip_serializing_if = "Option::is_none")]
pub motions: Option<Vec<Option<String>>>,
/// The negative prompt to use. Use it to address details that you don't want
/// in the image. This could be colors, objects, scenery and even the small details
/// (e.g. moustache, blurry, low resolution).
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// The number of inference steps to perform. 4-12 is recommended for turbo mode.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// The prompt to use for generating the image. Be as descriptive as possible for best results.
/// "closeup of tony stark, robert downey jr, fireworks, high quality, ultra HD"
/// "panda playing a guitar, on a boat, in the ocean, high quality, high quality, ultra HD, realistic"
pub prompt: String,
/// The same seed and the same prompt given to the same version of Stable Diffusion
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// The strength of the input video in the final output.
#[serde(skip_serializing_if = "Option::is_none")]
pub strength: Option<f64>,
/// URL of the video.
/// "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/animatediff-vid2vid-input-2.gif"
/// "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/animatediff-vid2vid-input-1.gif"
pub video_url: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct File {
/// The mime type of the file.
/// "image/png"
#[serde(skip_serializing_if = "Option::is_none")]
pub content_type: Option<String>,
/// The name of the file. It will be auto-generated if not provided.
/// "z9RV14K95DvU.png"
#[serde(skip_serializing_if = "Option::is_none")]
pub file_name: Option<String>,
/// The size of the file in bytes.
/// 4404019
#[serde(skip_serializing_if = "Option::is_none")]
pub file_size: Option<i64>,
/// The URL where the file can be downloaded from.
pub url: String,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct HTTPValidationError {
#[serde(skip_serializing_if = "Option::is_none")]
pub detail: Option<Vec<Option<ValidationError>>>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ImageSize {
/// The height of the generated image.
#[serde(skip_serializing_if = "Option::is_none")]
pub height: Option<i64>,
/// The width of the generated image.
#[serde(skip_serializing_if = "Option::is_none")]
pub width: Option<i64>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ValidationError {
pub loc: Vec<serde_json::Value>,
pub msg: String,
#[serde(rename = "type")]
pub ty: String,
}
#[derive(Debug, Serialize, Deserialize, smart_default::SmartDefault)]
#[allow(non_camel_case_types)]
pub enum VideoSizeProperty {
#[default]
ImageSize(ImageSize),
#[serde(rename = "square_hd")]
SquareHd,
#[serde(rename = "square")]
Square,
#[serde(rename = "portrait_4_3")]
Portrait43,
#[serde(rename = "portrait_16_9")]
Portrait169,
#[serde(rename = "landscape_4_3")]
Landscape43,
#[serde(rename = "landscape_16_9")]
Landscape169,
}
/// AnimateDiff
///
/// Category: text-to-video
/// Machine Type: A100
pub fn video_to_video(
params: AnimateDiffV2VInput,
) -> FalRequest<AnimateDiffV2VInput, AnimateDiffV2VOutput> {
FalRequest::new("fal-ai/fast-animatediff/video-to-video", params)
}
@@ -0,0 +1,285 @@
#[allow(unused_imports)]
use crate::prelude::*;
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::collections::HashMap;
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Embedding {
/// URL or the path to the embedding weights.
/// "https://civitai.com/api/download/models/135931"
/// "https://filebin.net/3chfqasxpqu21y8n/my-custom-lora-v1.safetensors"
pub path: String,
/// The list of tokens to use for the embedding.
#[serde(skip_serializing_if = "Option::is_none")]
pub tokens: Option<Vec<Option<String>>>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct HTTPValidationError {
#[serde(skip_serializing_if = "Option::is_none")]
pub detail: Option<Vec<Option<ValidationError>>>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Image {
#[serde(skip_serializing_if = "Option::is_none")]
pub content_type: Option<String>,
pub height: i64,
pub url: String,
pub width: i64,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ImageSize {
/// The height of the generated image.
#[serde(skip_serializing_if = "Option::is_none")]
pub height: Option<i64>,
/// The width of the generated image.
#[serde(skip_serializing_if = "Option::is_none")]
pub width: Option<i64>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ImageToImageFooocusInput {
/// The list of embeddings to use.
#[serde(skip_serializing_if = "Option::is_none")]
pub embeddings: Option<Vec<Option<Embedding>>>,
/// If set to true, a smaller model will try to refine the output after it was processed.
#[serde(skip_serializing_if = "Option::is_none")]
pub enable_refiner: Option<bool>,
/// If set to true, the safety checker will be enabled.
#[serde(skip_serializing_if = "Option::is_none")]
pub enable_safety_checker: Option<bool>,
/// If set to true, the prompt will be expanded with additional prompts.
#[serde(skip_serializing_if = "Option::is_none")]
pub expand_prompt: Option<bool>,
/// The format of the generated image.
#[serde(skip_serializing_if = "Option::is_none")]
pub format: Option<String>,
/// The rescale factor for the CFG.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance_rescale: Option<f64>,
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want
/// the model to stick to your prompt when looking for a related image to show you.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance_scale: Option<f64>,
/// The size of the generated image. Leave it none to automatically infer from the prompt image.
/// null
#[serde(skip_serializing_if = "Option::is_none")]
pub image_size: Option<ImageSizeProperty>,
/// The URL of the image to use as a starting point for the generation.
/// "https://fal-cdn.batuhan-941.workers.dev/files/tiger/IExuP-WICqaIesLZAZPur.jpeg"
pub image_url: String,
/// The negative prompt to use.Use it to address details that you don't want
/// in the image. This could be colors, objects, scenery and even the small details
/// (e.g. moustache, blurry, low resolution).
/// "cartoon, illustration, animation. face. male, female"
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// The number of images to generate.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_images: Option<i64>,
/// The number of inference steps to perform.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// The prompt to use for generating the image. Be as descriptive as possible for best results.
/// "an island near sea, with seagulls, moon shining over the sea, light house, boats int he background, fish flying over the sea"
pub prompt: String,
/// The version of the safety checker to use. v1 is the default CompVis safety checker. v2 uses a custom ViT model.
#[serde(skip_serializing_if = "Option::is_none")]
pub safety_checker_version: Option<String>,
/// The same seed and the same prompt given to the same version of Stable Diffusion
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// determines how much the generated image resembles the initial image
#[serde(skip_serializing_if = "Option::is_none")]
pub strength: Option<f64>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct InpaintingFooocusInput {
/// The list of embeddings to use.
#[serde(skip_serializing_if = "Option::is_none")]
pub embeddings: Option<Vec<Option<Embedding>>>,
/// If set to true, a smaller model will try to refine the output after it was processed.
#[serde(skip_serializing_if = "Option::is_none")]
pub enable_refiner: Option<bool>,
/// If set to true, the safety checker will be enabled.
#[serde(skip_serializing_if = "Option::is_none")]
pub enable_safety_checker: Option<bool>,
/// If set to true, the prompt will be expanded with additional prompts.
#[serde(skip_serializing_if = "Option::is_none")]
pub expand_prompt: Option<bool>,
/// The format of the generated image.
#[serde(skip_serializing_if = "Option::is_none")]
pub format: Option<String>,
/// The rescale factor for the CFG.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance_rescale: Option<f64>,
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want
/// the model to stick to your prompt when looking for a related image to show you.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance_scale: Option<f64>,
/// The size of the generated image.
#[serde(skip_serializing_if = "Option::is_none")]
pub image_size: Option<ImageSizeProperty>,
/// The URL of the image to use as a starting point for the generation.
/// "https://raw.githubusercontent.com/CompVis/latent-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo.png"
pub image_url: String,
/// The URL of the mask to use for inpainting.
/// "https://raw.githubusercontent.com/CompVis/latent-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo_mask.png"
pub mask_url: String,
/// The negative prompt to use.Use it to address details that you don't want
/// in the image. This could be colors, objects, scenery and even the small details
/// (e.g. moustache, blurry, low resolution).
/// "cartoon, illustration, animation. face. male, female"
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// The number of images to generate.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_images: Option<i64>,
/// The number of inference steps to perform.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// The prompt to use for generating the image. Be as descriptive as possible for best results.
/// "a tiger sitting on a park bench"
pub prompt: String,
/// The version of the safety checker to use. v1 is the default CompVis safety checker. v2 uses a custom ViT model.
#[serde(skip_serializing_if = "Option::is_none")]
pub safety_checker_version: Option<String>,
/// The same seed and the same prompt given to the same version of Stable Diffusion
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// determines how much the generated image resembles the initial image
#[serde(skip_serializing_if = "Option::is_none")]
pub strength: Option<f64>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct LoraWeight {
/// If set to true, the embedding will be forced to be used.
#[serde(skip_serializing_if = "Option::is_none")]
pub force: Option<bool>,
/// URL or the path to the LoRA weights. Or HF model name.
/// "https://civitai.com/api/download/models/135931"
/// "https://filebin.net/3chfqasxpqu21y8n/my-custom-lora-v1.safetensors"
pub path: String,
/// The scale of the LoRA weight. This is used to scale the LoRA weight
/// before merging it with the base model.
#[serde(skip_serializing_if = "Option::is_none")]
pub scale: Option<f64>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct Output {
/// Whether the generated images contain NSFW concepts.
pub has_nsfw_concepts: Vec<bool>,
/// The generated image files info.
pub images: Vec<Image>,
/// The prompt used for generating the image.
pub prompt: String,
/// Seed of the generated Image. It will be the same value of the one passed in the
/// input or the randomly generated that was used in case none was passed.
pub seed: i64,
pub timings: Timings,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct TextToImageFooocusInput {
/// The list of embeddings to use.
#[serde(skip_serializing_if = "Option::is_none")]
pub embeddings: Option<Vec<Option<Embedding>>>,
/// If set to true, a smaller model will try to refine the output after it was processed.
#[serde(skip_serializing_if = "Option::is_none")]
pub enable_refiner: Option<bool>,
/// If set to true, the safety checker will be enabled.
#[serde(skip_serializing_if = "Option::is_none")]
pub enable_safety_checker: Option<bool>,
/// If set to true, the prompt will be expanded with additional prompts.
#[serde(skip_serializing_if = "Option::is_none")]
pub expand_prompt: Option<bool>,
/// The format of the generated image.
#[serde(skip_serializing_if = "Option::is_none")]
pub format: Option<String>,
/// The rescale factor for the CFG.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance_rescale: Option<f64>,
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want
/// the model to stick to your prompt when looking for a related image to show you.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance_scale: Option<f64>,
/// The size of the generated image.
#[serde(skip_serializing_if = "Option::is_none")]
pub image_size: Option<ImageSizeProperty>,
/// The negative prompt to use. Use it to address details that you don't want
/// in the image. This could be colors, objects, scenery and even the small details
/// (e.g. moustache, blurry, low resolution).
/// "cartoon, illustration, animation. face. male, female"
/// "ugly, deformed"
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// The number of images to generate.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_images: Option<i64>,
/// The number of inference steps to perform.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_inference_steps: Option<i64>,
/// The prompt to use for generating the image. Be as descriptive as possible for best results.
/// "Self-portrait oil painting, a beautiful cyborg with golden hair, 8k."
pub prompt: String,
/// The version of the safety checker to use. v1 is the default CompVis safety checker. v2 uses a custom ViT model.
#[serde(skip_serializing_if = "Option::is_none")]
pub safety_checker_version: Option<String>,
/// The same seed and the same prompt given to the same version of Stable Diffusion
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ValidationError {
pub loc: Vec<serde_json::Value>,
pub msg: String,
#[serde(rename = "type")]
pub ty: String,
}
#[derive(Debug, Serialize, Deserialize, smart_default::SmartDefault)]
#[allow(non_camel_case_types)]
pub enum ImageSizeProperty {
#[default]
ImageSize(ImageSize),
#[serde(rename = "square_hd")]
SquareHd,
#[serde(rename = "square")]
Square,
#[serde(rename = "portrait_4_3")]
Portrait43,
#[serde(rename = "portrait_16_9")]
Portrait169,
#[serde(rename = "landscape_4_3")]
Landscape43,
#[serde(rename = "landscape_16_9")]
Landscape169,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Timings {
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(rename = "type")]
pub ty: Option<serde_json::Value>,
}
/// Fooocus
///
/// Category: text-to-image
/// Machine Type: A100
pub fn image_to_image(
params: ImageToImageFooocusInput,
) -> FalRequest<ImageToImageFooocusInput, Output> {
FalRequest::new("fal-ai/fast-fooocus-sdxl/image-to-image", params)
}

Some files were not shown because too many files have changed in this diff Show More