mirror of
https://github.com/storytold/artcraft.git
synced 2026-10-20 17:02:53 -04:00
remove fal.rs and move everything into fal_client (#1183)
This commit is contained in:
Generated
+3
-152
@@ -1014,7 +1014,7 @@ dependencies = [
|
||||
"serde_path_to_error",
|
||||
"serde_qs 0.10.1",
|
||||
"sha2 0.10.8",
|
||||
"smart-default 0.6.0",
|
||||
"smart-default",
|
||||
"smol_str 0.1.24",
|
||||
"thiserror 1.0.63",
|
||||
"tokio",
|
||||
@@ -1998,17 +1998,6 @@ 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.18",
|
||||
"toml 0.8.23",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cargo-platform"
|
||||
version = "0.1.9"
|
||||
@@ -3978,17 +3967,6 @@ dependencies = [
|
||||
"pin-project-lite",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "eventsource-stream"
|
||||
version = "0.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "74fef4569247a5f429d9156b9d0a2599914385dd189c539334c625d8099d90ab"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"nom",
|
||||
"pin-project-lite",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "exr"
|
||||
version = "1.73.0"
|
||||
@@ -4004,49 +3982,22 @@ dependencies = [
|
||||
"zune-inflate",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fal"
|
||||
version = "0.3.6"
|
||||
dependencies = [
|
||||
"base64 0.22.1",
|
||||
"eventsource-stream",
|
||||
"fal-derive",
|
||||
"futures 0.3.32",
|
||||
"image",
|
||||
"log",
|
||||
"percent-encoding-rfc3986",
|
||||
"reqwest 0.12.23",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"smart-default 0.7.1",
|
||||
"thiserror 1.0.63",
|
||||
"tokio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fal-derive"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.117",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fal_client"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"errors",
|
||||
"fal",
|
||||
"file_to_base64_url",
|
||||
"futures 0.3.32",
|
||||
"log",
|
||||
"reqwest 0.12.23",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"strum",
|
||||
"test_data",
|
||||
"test_utils",
|
||||
"thiserror 2.0.18",
|
||||
"tokio",
|
||||
"url",
|
||||
"workspace-build-acceleration",
|
||||
@@ -4545,21 +4496,6 @@ dependencies = [
|
||||
"x11",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "generate-endpoints"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"cargo-manifest",
|
||||
"percent-encoding",
|
||||
"reqwest 0.12.23",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"tokio",
|
||||
"toml 0.8.23",
|
||||
"tracing",
|
||||
"tracing-subscriber",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "generic-array"
|
||||
version = "0.14.7"
|
||||
@@ -7323,16 +7259,6 @@ 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",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num"
|
||||
version = "0.4.3"
|
||||
@@ -8079,12 +8005,6 @@ version = "6.6.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e2355d85b9a3786f481747ced0e0ff2ba35213a1f9bd406ed906554d7af805a1"
|
||||
|
||||
[[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"
|
||||
@@ -8263,12 +8183,6 @@ version = "2.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220"
|
||||
|
||||
[[package]]
|
||||
name = "percent-encoding-rfc3986"
|
||||
version = "0.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3637c05577168127568a64e9dc5a6887da720efef07b3d9472d45f63ab191166"
|
||||
|
||||
[[package]]
|
||||
name = "phf"
|
||||
version = "0.8.0"
|
||||
@@ -10756,15 +10670,6 @@ 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 = "shlex"
|
||||
version = "1.3.0"
|
||||
@@ -10855,17 +10760,6 @@ dependencies = [
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "smart-default"
|
||||
version = "0.7.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0eb01866308440fc64d6c44d9e86c5cc17adfe33c4d6eed55da9145044d0ffc1"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.117",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "smol_str"
|
||||
version = "0.1.24"
|
||||
@@ -12365,16 +12259,6 @@ dependencies = [
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thread_local"
|
||||
version = "1.1.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"once_cell",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thumbnail_generator"
|
||||
version = "0.1.0"
|
||||
@@ -12626,7 +12510,6 @@ version = "0.8.23"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362"
|
||||
dependencies = [
|
||||
"indexmap 2.13.0",
|
||||
"serde",
|
||||
"serde_spanned 0.6.9",
|
||||
"toml_datetime 0.6.11",
|
||||
@@ -12887,32 +12770,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
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",
|
||||
"thread_local",
|
||||
"tracing-core",
|
||||
"tracing-log",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -13413,12 +13270,6 @@ 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.12.0"
|
||||
|
||||
@@ -144,9 +144,6 @@ members = [
|
||||
"crates/testing/test_utils",
|
||||
|
||||
# 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",
|
||||
"crates/vendor/Symphonia/symphonia",
|
||||
|
||||
@@ -12,7 +12,7 @@ name = "fal_client"
|
||||
path = "src/lib.rs"
|
||||
|
||||
[dependencies]
|
||||
# Workspace hack (faster compile times)
|
||||
# cargo-hakari workspace hack (faster compile times)
|
||||
workspace-build-acceleration.workspace = true
|
||||
|
||||
# Internal
|
||||
@@ -25,15 +25,16 @@ futures.workspace = true
|
||||
log.workspace = true
|
||||
reqwest.workspace = true
|
||||
serde.workspace = true
|
||||
serde_json.workspace = true
|
||||
strum.workspace = true
|
||||
thiserror.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]
|
||||
test_utils = { path = "../../testing/test_utils" }
|
||||
# Internal Dev
|
||||
test_utils.workspace = true
|
||||
test_data.workspace = true
|
||||
|
||||
# External Dev
|
||||
# (None yet)
|
||||
|
||||
@@ -1,16 +1,14 @@
|
||||
use crate::error::fal_error::FalError;
|
||||
use crate::error::fal_error_plus::FalErrorPlus;
|
||||
|
||||
const BILLING_ERROR : &str = "{\"detail\": \"User is locked. Reason: Exhausted balance. Top up your balance at fal.ai/dashboard/billing.\"}";
|
||||
|
||||
/// Better classify the `fal::FalError` into a more user-friendly `FalErrorPlus`.
|
||||
pub fn classify_fal_error(err: fal::FalError) -> FalErrorPlus {
|
||||
// Other("{\"detail\": \"User is locked. Reason: Exhausted balance. Top up your balance at fal.ai/dashboard/billing.\"}")
|
||||
/// Better classify the `FalError` into a more user-friendly `FalErrorPlus`.
|
||||
pub fn classify_fal_error(err: FalError) -> FalErrorPlus {
|
||||
match err {
|
||||
fal::FalError::RequestError(_) => FalErrorPlus::FalError(err),
|
||||
fal::FalError::ImageError(_) => FalErrorPlus::FalError(err),
|
||||
fal::FalError::SerializeError(_) => FalErrorPlus::FalError(err),
|
||||
fal::FalError::StreamError(_) => FalErrorPlus::FalError(err),
|
||||
fal::FalError::Other(ref inner) => {
|
||||
FalError::RequestError(_) => FalErrorPlus::FalError(err),
|
||||
FalError::SerializeError(_) => FalErrorPlus::FalError(err),
|
||||
FalError::Other(ref inner) => {
|
||||
if inner == BILLING_ERROR {
|
||||
FalErrorPlus::FalBillingError(inner.to_string())
|
||||
} else if inner.contains("billing") {
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
/// Error type for Fal API interactions.
|
||||
///
|
||||
/// Originally from the vendored `fal` crate (`fal::FalError`).
|
||||
/// Copied here so `fal_client` can be independent of the vendored crate.
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
pub enum FalError {
|
||||
#[error("fal request failed: {0}")]
|
||||
RequestError(#[from] reqwest::Error),
|
||||
|
||||
#[error("serialization error: {0}")]
|
||||
SerializeError(#[from] serde_json::Error),
|
||||
|
||||
#[error("error: {0}")]
|
||||
Other(String),
|
||||
}
|
||||
|
||||
impl From<String> for FalError {
|
||||
fn from(s: String) -> Self {
|
||||
FalError::Other(s)
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,13 @@
|
||||
use crate::error::classify_fal_error::classify_fal_error;
|
||||
use crate::error::fal_error::FalError;
|
||||
use std::error::Error;
|
||||
use std::fmt::{Display, Formatter};
|
||||
|
||||
/// Additional errors that aren't included in `fal::FalError`.
|
||||
/// Additional errors that aren't included in `crate::error::fal_error::FalError`.
|
||||
#[derive(Debug)]
|
||||
pub enum FalErrorPlus {
|
||||
/// An error arising in the `fal` crate.
|
||||
FalError(fal::FalError),
|
||||
FalError(crate::error::fal_error::FalError),
|
||||
/// The fal API key is invalid.
|
||||
FalApiKeyError(String),
|
||||
/// The fal account has a billing issue
|
||||
@@ -37,8 +38,8 @@ impl Display for FalErrorPlus {
|
||||
|
||||
impl Error for FalErrorPlus {}
|
||||
|
||||
impl From<fal::FalError> for FalErrorPlus {
|
||||
fn from(err: fal::FalError) -> Self {
|
||||
impl From<FalError> for FalErrorPlus {
|
||||
fn from(err: FalError) -> Self {
|
||||
classify_fal_error(err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
pub mod classify_fal_error;
|
||||
pub mod fal_error;
|
||||
pub mod fal_error_plus;
|
||||
@@ -1,11 +1,4 @@
|
||||
//! A wrapper for the "fal" crate that bakes in a few extra recipes and utilities.
|
||||
|
||||
extern crate fal;
|
||||
|
||||
// Re-export
|
||||
pub mod export {
|
||||
pub use fal::*;
|
||||
}
|
||||
//! A fal wrapper
|
||||
|
||||
pub mod creds;
|
||||
pub mod error;
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
use crate::creds::fal_api_key::FalApiKey;
|
||||
use crate::model::fal_endpoint::FalEndpoint;
|
||||
use crate::model::fal_request_id::FalRequestId;
|
||||
use crate::requests::api::queue::Queue;
|
||||
use crate::requests::api::queue_response::QueueResponse;
|
||||
use errors::AnyhowResult;
|
||||
use fal::queue::{Queue, QueueResponse};
|
||||
use reqwest::Client;
|
||||
use serde::de::DeserializeOwned;
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
use fal::queue::Queue;
|
||||
use crate::requests::api::queue::Queue;
|
||||
use serde::de::DeserializeOwned;
|
||||
|
||||
// TODO(bt,2025-05-26): A macro to define these + tests.
|
||||
|
||||
const FLUX_PRO_ULTRA_TEXT_TO_IMAGE: &str = "fal-ai/flux-pro/v1.1-ultra";
|
||||
|
||||
@@ -0,0 +1,135 @@
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use reqwest::IntoUrl;
|
||||
use serde::{de::DeserializeOwned, Serialize};
|
||||
use log::info;
|
||||
|
||||
use crate::error::fal_error::FalError;
|
||||
use crate::requests::api::queue::Queue;
|
||||
use crate::requests::api::queue_response::QueueResponse;
|
||||
use crate::requests::api::webhook_response::WebhookResponse;
|
||||
|
||||
/// A request to the FAL API.
|
||||
///
|
||||
/// Originally from the vendored `fal` crate (`fal::request::FalRequest`).
|
||||
/// Copied here so `fal_client` can be independent of the vendored crate.
|
||||
#[derive(Debug)]
|
||||
pub struct FalRequest<Params: Serialize, Response: DeserializeOwned> {
|
||||
/// The Reqwest Client to use to make requests
|
||||
pub client: reqwest::Client,
|
||||
/// The endpoint to make the request to
|
||||
pub endpoint: String,
|
||||
/// The parameters to send to the endpoint
|
||||
pub params: Params,
|
||||
/// The API key to use to make the request.
|
||||
/// If not provided, the `FAL_API_KEY` environment variable will be used.
|
||||
pub api_key: Option<String>,
|
||||
phantom: PhantomData<Response>,
|
||||
}
|
||||
|
||||
impl<Params: Serialize, Response: DeserializeOwned> FalRequest<Params, Response> {
|
||||
pub fn new(endpoint: impl Into<String>, params: Params) -> Self {
|
||||
Self {
|
||||
client: reqwest::Client::new(),
|
||||
endpoint: endpoint.into(),
|
||||
params,
|
||||
api_key: std::env::var("FAL_API_KEY").ok(),
|
||||
phantom: PhantomData,
|
||||
}
|
||||
}
|
||||
|
||||
/// Use a specific Reqwest Client to make requests
|
||||
pub fn with_client(mut self, client: reqwest::Client) -> Self {
|
||||
self.client = client;
|
||||
self
|
||||
}
|
||||
|
||||
/// Use a specific API key to make requests
|
||||
pub fn with_api_key(mut self, api_key: impl Into<String>) -> Self {
|
||||
self.api_key = Some(api_key.into());
|
||||
self
|
||||
}
|
||||
|
||||
/// Send the request and wait for the response
|
||||
pub async fn send(self) -> Result<Response, FalError> {
|
||||
let response = self
|
||||
.client
|
||||
.post(format!("https://fal.run/{}", self.endpoint))
|
||||
.json(&self.params)
|
||||
.header(
|
||||
"Authorization",
|
||||
format!(
|
||||
"Key {}",
|
||||
self.api_key.expect(
|
||||
"No fal API key provided, and FAL_API_KEY environment variable is not set"
|
||||
)
|
||||
),
|
||||
)
|
||||
.header("Content-Type", "application/json")
|
||||
.send()
|
||||
.await?;
|
||||
|
||||
if response.status() != 200 {
|
||||
let error = response.text().await?;
|
||||
return Err(error.into());
|
||||
}
|
||||
|
||||
Ok(response.error_for_status()?.json().await?)
|
||||
}
|
||||
|
||||
/// Submit the request to the Fal queue system.
|
||||
pub async fn queue(self) -> Result<Queue<Response>, FalError> {
|
||||
let key = self
|
||||
.api_key
|
||||
.expect("No fal API key provided, and FAL_API_KEY environment variable is not set");
|
||||
|
||||
let response = self
|
||||
.client
|
||||
.post(format!("https://queue.fal.run/{}", self.endpoint))
|
||||
.json(&self.params)
|
||||
.header("Authorization", format!("Key {}", &key))
|
||||
.header("Content-Type", "application/json")
|
||||
.send()
|
||||
.await?;
|
||||
|
||||
if response.status() != 200 {
|
||||
let error = response.text().await?;
|
||||
return Err(error.into());
|
||||
}
|
||||
|
||||
let payload: QueueResponse = response.error_for_status()?.json().await?;
|
||||
|
||||
Ok(Queue::new(self.client, self.endpoint, key, payload))
|
||||
}
|
||||
|
||||
/// Submit the request to the Fal queue with a webhook callback URL.
|
||||
pub async fn queue_webhook<U: IntoUrl>(self, url: U) -> Result<WebhookResponse, FalError> {
|
||||
let key = self
|
||||
.api_key
|
||||
.expect("No fal API key provided, and FAL_API_KEY environment variable is not set");
|
||||
|
||||
let url_encoded = url.into_url()?;
|
||||
|
||||
let request_url = format!("https://queue.fal.run/{}?fal_webhook={}", self.endpoint, url_encoded);
|
||||
|
||||
info!("Sending request to FAL queue webhook: {}", request_url);
|
||||
|
||||
let response = self
|
||||
.client
|
||||
.post(request_url)
|
||||
.json(&self.params)
|
||||
.header("Authorization", format!("Key {}", &key))
|
||||
.header("Content-Type", "application/json")
|
||||
.send()
|
||||
.await?;
|
||||
|
||||
if response.status() != 200 {
|
||||
let error = response.text().await?;
|
||||
return Err(error.into());
|
||||
}
|
||||
|
||||
let payload: WebhookResponse = response.error_for_status()?.json().await?;
|
||||
|
||||
Ok(payload)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
pub mod fal_request;
|
||||
pub mod queue;
|
||||
pub mod queue_response;
|
||||
pub mod queue_status;
|
||||
pub mod webhook_response;
|
||||
@@ -0,0 +1,86 @@
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use serde::{de::DeserializeOwned, Deserialize, Serialize};
|
||||
|
||||
use crate::error::fal_error::FalError;
|
||||
use crate::requests::api::queue_response::QueueResponse;
|
||||
use crate::requests::api::queue_status::QueueStatus;
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct Queue<Response: DeserializeOwned> {
|
||||
#[serde(skip)]
|
||||
pub client: Option<reqwest::Client>,
|
||||
pub endpoint: String,
|
||||
pub api_key: String,
|
||||
pub payload: QueueResponse,
|
||||
phantom: PhantomData<Response>,
|
||||
}
|
||||
|
||||
impl<Response: DeserializeOwned> Queue<Response> {
|
||||
pub fn new(
|
||||
client: reqwest::Client,
|
||||
endpoint: impl Into<String>,
|
||||
api_key: String,
|
||||
payload: QueueResponse,
|
||||
) -> Self {
|
||||
Self {
|
||||
client: Some(client),
|
||||
endpoint: endpoint.into(),
|
||||
api_key,
|
||||
payload,
|
||||
phantom: PhantomData,
|
||||
}
|
||||
}
|
||||
|
||||
/// Get the status of the Queue request
|
||||
pub async fn status(&self, show_logs: bool) -> Result<QueueStatus, FalError> {
|
||||
let response = self
|
||||
.client
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.get(&self.payload.status_url)
|
||||
.query(&[("logs", if show_logs { "1" } else { "0" })])
|
||||
.header("Authorization", format!("Key {}", self.api_key))
|
||||
.header("Content-Type", "application/json")
|
||||
.send()
|
||||
.await?;
|
||||
|
||||
Ok(response.error_for_status()?.json().await?)
|
||||
}
|
||||
|
||||
/// Get the response of the Queue request, if the request is Completed
|
||||
pub async fn response(&self) -> Result<Response, FalError> {
|
||||
let response = self
|
||||
.client
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.get(&self.payload.response_url)
|
||||
.header("Authorization", format!("Key {}", self.api_key))
|
||||
.header("Content-Type", "application/json")
|
||||
.send()
|
||||
.await?;
|
||||
|
||||
if response.status() != 200 {
|
||||
let error = response.text().await?;
|
||||
return Err(error.into());
|
||||
}
|
||||
|
||||
Ok(response.error_for_status()?.json().await?)
|
||||
}
|
||||
|
||||
/// Cancel the Queue request
|
||||
pub async fn cancel(&self) -> Result<(), FalError> {
|
||||
let response = self
|
||||
.client
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.put(&self.payload.cancel_url)
|
||||
.header("Authorization", format!("Key {}", self.api_key))
|
||||
.send()
|
||||
.await?;
|
||||
|
||||
response.error_for_status()?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct QueueResponse {
|
||||
pub request_id: String,
|
||||
pub response_url: String,
|
||||
pub status_url: String,
|
||||
pub cancel_url: String,
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq)]
|
||||
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
|
||||
pub enum Status {
|
||||
InQueue,
|
||||
InProgress,
|
||||
Completed,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct RequestLog {
|
||||
pub timestamp: String,
|
||||
pub level: Option<String>,
|
||||
pub source: Option<String>,
|
||||
pub message: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct QueueStatus {
|
||||
/// The status of the Queue request
|
||||
pub status: Status,
|
||||
/// The position of the request in the queue
|
||||
pub queue_position: Option<i64>,
|
||||
/// The URL of the response
|
||||
pub response_url: String,
|
||||
/// The logs of the request, if `show_logs` is `true`
|
||||
pub logs: Option<Vec<RequestLog>>,
|
||||
}
|
||||
+1
-2
@@ -1,5 +1,4 @@
|
||||
|
||||
use crate::prelude::{Deserialize, Serialize};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
pub struct WebhookResponse {
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
use fal::request::FalRequest;
|
||||
use crate::requests::api::fal_request::FalRequest;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
use fal::request::FalRequest;
|
||||
use crate::requests::api::fal_request::FalRequest;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
use crate::requests::api::fal_request::FalRequest;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
pub struct RembgRemoveBackgroundInput {
|
||||
pub image_url: String,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub crop_to_bbox: Option<bool>,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub sync_mode: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct RembgRemoveBackgroundFile {
|
||||
pub url: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct RembgRemoveBackgroundOutput {
|
||||
pub image: RembgRemoveBackgroundFile,
|
||||
}
|
||||
|
||||
pub fn rembg_remove_background(
|
||||
params: RembgRemoveBackgroundInput,
|
||||
) -> FalRequest<RembgRemoveBackgroundInput, RembgRemoveBackgroundOutput> {
|
||||
FalRequest::new("fal-ai/imageutils/rembg", params)
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
pub mod http_rembg_remove_background;
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
use crate::requests::api::fal_request::FalRequest;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
pub struct FluxProKontextMaxEditInput {
|
||||
pub prompt: String,
|
||||
|
||||
pub image_url: String,
|
||||
|
||||
/// 1 - 4
|
||||
/// Default: 1
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub num_images: Option<i64>,
|
||||
|
||||
/// "png" or "jpeg"
|
||||
/// Default: "jpeg"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub output_format: Option<String>,
|
||||
|
||||
/// Aspect ratio for the generated image.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub aspect_ratio: Option<String>,
|
||||
|
||||
/// The safety tolerance level for content moderation.
|
||||
/// "1" (most strict) to "5" (most permissive).
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub safety_tolerance: Option<String>,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub seed: Option<i64>,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub sync_mode: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct FluxProKontextMaxEditFile {
|
||||
pub url: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct FluxProKontextMaxEditOutput {
|
||||
pub images: Vec<FluxProKontextMaxEditFile>,
|
||||
}
|
||||
|
||||
pub fn flux_pro_kontext_max_edit(
|
||||
params: FluxProKontextMaxEditInput,
|
||||
) -> FalRequest<FluxProKontextMaxEditInput, FluxProKontextMaxEditOutput> {
|
||||
FalRequest::new("fal-ai/flux-pro/kontext/max", params)
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
use crate::requests::api::fal_request::FalRequest;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
pub struct Gemini25FlashEditInput {
|
||||
pub prompt: String,
|
||||
|
||||
pub image_urls: Vec<String>,
|
||||
|
||||
/// 1 - 4
|
||||
/// Default: 1
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub num_images: Option<u8>,
|
||||
|
||||
/// "jpeg" or "png"
|
||||
/// Default: "png"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub output_format: Option<String>,
|
||||
|
||||
/// Aspect ratio for the generated image.
|
||||
/// Options: auto, 21:9, 16:9, 3:2, 4:3, 5:4, 1:1, 4:5, 3:4, 2:3, 9:16
|
||||
/// Default: "auto"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub aspect_ratio: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct Gemini25FlashEditFile {
|
||||
pub url: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct Gemini25FlashEditOutput {
|
||||
pub images: Vec<Gemini25FlashEditFile>,
|
||||
}
|
||||
|
||||
pub fn gemini_25_flash_edit(
|
||||
params: Gemini25FlashEditInput,
|
||||
) -> FalRequest<Gemini25FlashEditInput, Gemini25FlashEditOutput> {
|
||||
FalRequest::new("fal-ai/gemini-25-flash-image/edit", params)
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
use crate::requests::api::fal_request::FalRequest;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
pub struct GptImage1EditImageInput {
|
||||
pub prompt: String,
|
||||
|
||||
pub image_urls: Vec<String>,
|
||||
|
||||
/// "auto", "1024x1024", "1536x1024", "1024x1536"
|
||||
pub image_size: String,
|
||||
|
||||
/// 1 - 4
|
||||
pub num_images: u8,
|
||||
|
||||
/// "auto", "low", "medium", "high"
|
||||
pub quality: String,
|
||||
|
||||
/// BYOK - caller supplies their own OpenAI API key
|
||||
pub openai_api_key: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct GptImage1EditImageOutput {
|
||||
// Response fields parsed elsewhere
|
||||
}
|
||||
|
||||
pub fn gpt_image_1_edit_image(
|
||||
params: GptImage1EditImageInput,
|
||||
) -> FalRequest<GptImage1EditImageInput, GptImage1EditImageOutput> {
|
||||
FalRequest::new("fal-ai/gpt-image-1/edit-image/byok", params)
|
||||
}
|
||||
+19
-18
@@ -1,53 +1,54 @@
|
||||
use crate::prelude::{Deserialize, FalRequest, Serialize};
|
||||
use crate::requests::api::fal_request::FalRequest;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
pub struct GptImage1p5ImageEditInput {
|
||||
pub struct GptImage1p5EditImageInput {
|
||||
pub prompt: String,
|
||||
|
||||
pub image_urls: Vec<String>,
|
||||
|
||||
/// The URL of the mask image to use for the generation. This indicates what part of the image to edit.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub mask_image_url: Option<String>,
|
||||
|
||||
/// Eg. auto, 1024x1024, 1536x1024, 1024x1536
|
||||
/// "auto", "1024x1024", "1536x1024", "1024x1536"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub image_size: Option<String>,
|
||||
|
||||
/// Eg. Possible enum values: auto, transparent, opaque
|
||||
/// "auto", "transparent", "opaque"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub background: Option<String>,
|
||||
|
||||
/// Eg. Possible enum values: low, medium, high
|
||||
/// "low", "medium", "high"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub quality: Option<String>,
|
||||
|
||||
/// Eg. Possible enum values: low, high
|
||||
/// "low", "high"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub input_fidelity: Option<String>,
|
||||
|
||||
/// 1 - 4
|
||||
/// Default: 1
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub num_images: Option<u8>,
|
||||
|
||||
/// Possible enum values: jpeg, png, webp
|
||||
/// "jpeg", "png", "webp"
|
||||
/// Default: "png"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub output_format: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct GptImage1p5ImageEditOutput {
|
||||
pub images: Vec<ImageFile>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
pub struct ImageFile {
|
||||
/// The URL where the file can be downloaded from.
|
||||
pub struct GptImage1p5EditImageFile {
|
||||
pub url: String,
|
||||
}
|
||||
|
||||
pub fn gpt_image_1p5_image_edit(
|
||||
params: GptImage1p5ImageEditInput,
|
||||
) -> FalRequest<GptImage1p5ImageEditInput, GptImage1p5ImageEditOutput> {
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct GptImage1p5EditImageOutput {
|
||||
pub images: Vec<GptImage1p5EditImageFile>,
|
||||
}
|
||||
|
||||
pub fn gpt_image_1p5_edit_image(
|
||||
params: GptImage1p5EditImageInput,
|
||||
) -> FalRequest<GptImage1p5EditImageInput, GptImage1p5EditImageOutput> {
|
||||
FalRequest::new("fal-ai/gpt-image-1.5/edit", params)
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
use fal::request::FalRequest;
|
||||
use crate::requests::api::fal_request::FalRequest;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
use crate::requests::api::fal_request::FalRequest;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
pub struct NanoBananaProEditImageInput {
|
||||
pub prompt: String,
|
||||
|
||||
pub image_urls: Vec<String>,
|
||||
|
||||
/// Eg. "auto", "16:9", "1:1", etc.
|
||||
/// Options: auto, 21:9, 16:9, 3:2, 4:3, 5:4, 1:1, 4:5, 3:4, 2:3, 9:16
|
||||
/// Default: "auto"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub aspect_ratio: Option<String>,
|
||||
|
||||
/// Eg. "1K", "2K", "4K"
|
||||
/// Default: "1K"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub resolution: Option<String>,
|
||||
|
||||
/// 1 - 4
|
||||
/// Default: 1
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub num_images: Option<u8>,
|
||||
|
||||
/// "jpeg", "png", "webp"
|
||||
/// Default: "png"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub output_format: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct NanoBananaProEditImageFile {
|
||||
pub url: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct NanoBananaProEditImageOutput {
|
||||
pub images: Vec<NanoBananaProEditImageFile>,
|
||||
}
|
||||
|
||||
pub fn nano_banana_pro_edit_image(
|
||||
params: NanoBananaProEditImageInput,
|
||||
) -> FalRequest<NanoBananaProEditImageInput, NanoBananaProEditImageOutput> {
|
||||
FalRequest::new("fal-ai/nano-banana-pro/edit", params)
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
use crate::requests::api::fal_request::FalRequest;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
pub struct QwenImageEditInput {
|
||||
pub prompt: String,
|
||||
|
||||
pub image_url: String,
|
||||
|
||||
/// Options: square_hd, square, portrait_4_3, portrait_16_9, landscape_4_3, landscape_16_9
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub image_size: Option<String>,
|
||||
|
||||
/// 1 - 4
|
||||
/// Default: 1
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub num_images: Option<u8>,
|
||||
|
||||
/// "jpeg" or "png"
|
||||
/// Default: "png"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub output_format: Option<String>,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub negative_prompt: Option<String>,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub seed: Option<u64>,
|
||||
|
||||
/// Default: 30
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub num_inference_steps: Option<u8>,
|
||||
|
||||
/// Default: 4.0
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub guidance_scale: Option<f64>,
|
||||
|
||||
/// Default: true
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub enable_safety_checker: Option<bool>,
|
||||
|
||||
/// Options: "none", "regular", "high"
|
||||
/// Default: "none"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub acceleration: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct QwenImageEditFile {
|
||||
pub url: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct QwenImageEditOutput {
|
||||
pub images: Vec<QwenImageEditFile>,
|
||||
}
|
||||
|
||||
pub fn qwen_image_edit(
|
||||
params: QwenImageEditInput,
|
||||
) -> FalRequest<QwenImageEditInput, QwenImageEditOutput> {
|
||||
FalRequest::new("fal-ai/qwen-image-edit", params)
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
use crate::requests::api::fal_request::FalRequest;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
pub struct SeedEditV3EditInput {
|
||||
pub prompt: String,
|
||||
|
||||
pub image_url: String,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub guidance_scale: Option<f64>,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub enable_safety_checker: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct SeedEditV3EditFile {
|
||||
pub url: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct SeedEditV3EditOutput {
|
||||
pub image: Vec<SeedEditV3EditFile>,
|
||||
}
|
||||
|
||||
pub fn seededit_v3_edit(
|
||||
params: SeedEditV3EditInput,
|
||||
) -> FalRequest<SeedEditV3EditInput, SeedEditV3EditOutput> {
|
||||
FalRequest::new("fal-ai/bytedance/seededit/v3/edit-image", params)
|
||||
}
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
use crate::requests::api::fal_request::FalRequest;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
pub struct SeedreamV4EditImageInput {
|
||||
pub prompt: String,
|
||||
|
||||
/// Maximum 10 images. Excess images are ignored.
|
||||
pub image_urls: Vec<String>,
|
||||
|
||||
/// Options: square_hd, square, portrait_4_3, portrait_16_9, landscape_4_3, landscape_16_9, auto, auto_2K, auto_4K
|
||||
/// Default: "auto_2K"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub image_size: Option<String>,
|
||||
|
||||
/// 1 - 4
|
||||
/// Default: 1
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub num_images: Option<u8>,
|
||||
|
||||
/// 1 - 4
|
||||
/// Default: 1
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub max_images: Option<u8>,
|
||||
|
||||
/// Enum: "standard", "fast"
|
||||
/// Default: "standard"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub enhance_prompt_mode: Option<String>,
|
||||
|
||||
/// Default: true
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub enable_safety_checker: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct SeedreamV4EditImageFile {
|
||||
pub url: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct SeedreamV4EditImageOutput {
|
||||
pub images: Vec<SeedreamV4EditImageFile>,
|
||||
}
|
||||
|
||||
pub fn seedream_4_edit_image(
|
||||
params: SeedreamV4EditImageInput,
|
||||
) -> FalRequest<SeedreamV4EditImageInput, SeedreamV4EditImageOutput> {
|
||||
FalRequest::new("fal-ai/bytedance/seedream/v4/edit", params)
|
||||
}
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
use crate::requests::api::fal_request::FalRequest;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
pub struct SeedreamV4p5EditImageInput {
|
||||
pub prompt: String,
|
||||
|
||||
/// Maximum 10 images. Excess images are ignored.
|
||||
pub image_urls: Vec<String>,
|
||||
|
||||
/// Options: square_hd, square, portrait_4_3, portrait_16_9, landscape_4_3, landscape_16_9, auto_2K, auto_4K
|
||||
/// Default: "auto_2K"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub image_size: Option<String>,
|
||||
|
||||
/// 1 - 4
|
||||
/// Default: 1
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub num_images: Option<u8>,
|
||||
|
||||
/// 1 - 4
|
||||
/// Default: 1
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub max_images: Option<u8>,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub seed: Option<i64>,
|
||||
|
||||
/// Default: true
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub enable_safety_checker: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct SeedreamV4p5EditImageFile {
|
||||
pub url: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct SeedreamV4p5EditImageOutput {
|
||||
pub images: Vec<SeedreamV4p5EditImageFile>,
|
||||
}
|
||||
|
||||
pub fn seedream_4p5_edit_image(
|
||||
params: SeedreamV4p5EditImageInput,
|
||||
) -> FalRequest<SeedreamV4p5EditImageInput, SeedreamV4p5EditImageOutput> {
|
||||
FalRequest::new("fal-ai/bytedance/seedream/v4.5/edit", params)
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
use fal::request::FalRequest;
|
||||
use crate::requests::api::fal_request::FalRequest;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
@@ -0,0 +1,11 @@
|
||||
pub mod http_flux_pro_kontext_max_edit;
|
||||
pub mod http_gemini_25_flash_edit;
|
||||
pub mod http_gpt_image_1_edit_image;
|
||||
pub mod http_gpt_image_1p5_edit_image;
|
||||
pub mod http_nano_banana_2_edit_image;
|
||||
pub mod http_nano_banana_pro_edit_image;
|
||||
pub mod http_qwen_image_edit;
|
||||
pub mod http_seedream_4_edit_image;
|
||||
pub mod http_seedream_4p5_edit_image;
|
||||
pub mod http_seedream_5_edit_image;
|
||||
pub mod http_seededit_v3_edit;
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
use crate::requests::api::fal_request::FalRequest;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
pub struct FluxDevJuggernautInfillInput {
|
||||
pub prompt: String,
|
||||
|
||||
pub image_url: String,
|
||||
|
||||
pub mask_url: String,
|
||||
|
||||
/// 1 - 4
|
||||
/// Default: 1
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub num_images: Option<i64>,
|
||||
|
||||
/// "png" or "jpeg"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub output_format: Option<String>,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub seed: Option<i64>,
|
||||
|
||||
/// 0.0 - 1.0. 1.0 completely remakes the image, 0.0 preserves the original.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub strength: Option<f64>,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub num_inference_steps: Option<i64>,
|
||||
|
||||
/// Options: square_hd, square, portrait_4_3, portrait_16_9, landscape_4_3, landscape_16_9
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub image_size: Option<String>,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub enable_safety_checker: Option<bool>,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub guidance_scale: Option<f64>,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub sync_mode: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct FluxDevJuggernautInfillFile {
|
||||
pub url: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct FluxDevJuggernautInfillOutput {
|
||||
pub images: Vec<FluxDevJuggernautInfillFile>,
|
||||
}
|
||||
|
||||
pub fn flux_dev_juggernaut_infill(
|
||||
params: FluxDevJuggernautInfillInput,
|
||||
) -> FalRequest<FluxDevJuggernautInfillInput, FluxDevJuggernautInfillOutput> {
|
||||
FalRequest::new("rundiffusion-fal/juggernaut-flux-lora/inpainting", params)
|
||||
}
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
use crate::requests::api::fal_request::FalRequest;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
pub struct FluxPro1InfillInput {
|
||||
pub prompt: String,
|
||||
|
||||
pub image_url: String,
|
||||
|
||||
pub mask_url: String,
|
||||
|
||||
/// 1 - 4
|
||||
/// Default: 1
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub num_images: Option<i64>,
|
||||
|
||||
/// "1" (most strict) to "5" (most permissive)
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub safety_tolerance: Option<String>,
|
||||
|
||||
/// "png" or "jpeg"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub output_format: Option<String>,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub seed: Option<i64>,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub sync_mode: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct FluxPro1InfillFile {
|
||||
pub url: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct FluxPro1InfillOutput {
|
||||
pub images: Vec<FluxPro1InfillFile>,
|
||||
}
|
||||
|
||||
pub fn flux_pro_1_infill(
|
||||
params: FluxPro1InfillInput,
|
||||
) -> FalRequest<FluxPro1InfillInput, FluxPro1InfillOutput> {
|
||||
FalRequest::new("fal-ai/flux-pro/v1/fill", params)
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
pub mod http_flux_dev_juggernaut_infill;
|
||||
pub mod http_flux_pro_1_infill;
|
||||
@@ -1,5 +1,5 @@
|
||||
pub mod angle;
|
||||
pub mod http_nano_banana_2_edit_image;
|
||||
pub mod http_nano_banana_2_text_to_image;
|
||||
pub mod http_seedream_5_edit_image;
|
||||
pub mod http_seedream_5_text_to_image;
|
||||
pub mod background;
|
||||
pub mod edit;
|
||||
pub mod infill;
|
||||
pub mod text;
|
||||
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
use crate::requests::api::fal_request::FalRequest;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
pub struct Flux1DevTextToImageInput {
|
||||
pub prompt: String,
|
||||
|
||||
/// Options: square_hd, square, portrait_4_3, portrait_16_9, landscape_4_3, landscape_16_9
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub image_size: Option<String>,
|
||||
|
||||
/// 1 - 4
|
||||
/// Default: 1
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub num_images: Option<i64>,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub seed: Option<i64>,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub guidance_scale: Option<f64>,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub num_inference_steps: Option<i64>,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub enable_safety_checker: Option<bool>,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub sync_mode: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct Flux1DevTextToImageFile {
|
||||
pub url: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct Flux1DevTextToImageOutput {
|
||||
pub images: Vec<Flux1DevTextToImageFile>,
|
||||
}
|
||||
|
||||
pub fn flux_1_dev_text_to_image(
|
||||
params: Flux1DevTextToImageInput,
|
||||
) -> FalRequest<Flux1DevTextToImageInput, Flux1DevTextToImageOutput> {
|
||||
FalRequest::new("fal-ai/flux/dev", params)
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
use crate::requests::api::fal_request::FalRequest;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
pub struct Flux1SchnellTextToImageInput {
|
||||
pub prompt: String,
|
||||
|
||||
/// Options: square_hd, square, portrait_4_3, portrait_16_9, landscape_4_3, landscape_16_9
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub image_size: Option<String>,
|
||||
|
||||
/// 1 - 4
|
||||
/// Default: 1
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub num_images: Option<i64>,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub seed: Option<i64>,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub num_inference_steps: Option<i64>,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub enable_safety_checker: Option<bool>,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub sync_mode: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct Flux1SchnellTextToImageFile {
|
||||
pub url: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct Flux1SchnellTextToImageOutput {
|
||||
pub images: Vec<Flux1SchnellTextToImageFile>,
|
||||
}
|
||||
|
||||
pub fn flux_1_schnell_text_to_image(
|
||||
params: Flux1SchnellTextToImageInput,
|
||||
) -> FalRequest<Flux1SchnellTextToImageInput, Flux1SchnellTextToImageOutput> {
|
||||
FalRequest::new("fal-ai/flux/schnell", params)
|
||||
}
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
use crate::requests::api::fal_request::FalRequest;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
pub struct FluxPro11TextToImageInput {
|
||||
pub prompt: String,
|
||||
|
||||
/// Options: square_hd, square, portrait_4_3, portrait_16_9, landscape_4_3, landscape_16_9
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub image_size: Option<String>,
|
||||
|
||||
/// 1 - 4
|
||||
/// Default: 1
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub num_images: Option<i64>,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub seed: Option<i64>,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub enable_safety_checker: Option<bool>,
|
||||
|
||||
/// "1" (most strict) to "5" (most permissive)
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub safety_tolerance: Option<String>,
|
||||
|
||||
/// "png" or "jpeg"
|
||||
/// Default: "jpeg"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub output_format: Option<String>,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub sync_mode: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct FluxPro11TextToImageFile {
|
||||
pub url: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct FluxPro11TextToImageOutput {
|
||||
pub images: Vec<FluxPro11TextToImageFile>,
|
||||
}
|
||||
|
||||
pub fn flux_pro_11_text_to_image(
|
||||
params: FluxPro11TextToImageInput,
|
||||
) -> FalRequest<FluxPro11TextToImageInput, FluxPro11TextToImageOutput> {
|
||||
FalRequest::new("fal-ai/flux-pro/v1.1", params)
|
||||
}
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
use crate::requests::api::fal_request::FalRequest;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
pub struct FluxPro11UltraTextToImageInput {
|
||||
pub prompt: String,
|
||||
|
||||
/// Options: 21:9, 16:9, 4:3, 3:2, 1:1, 2:3, 3:4, 9:16, 9:21
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub aspect_ratio: Option<String>,
|
||||
|
||||
/// 1 - 4
|
||||
/// Default: 1
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub num_images: Option<i64>,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub seed: Option<i64>,
|
||||
|
||||
/// Generate less processed, more natural-looking images.
|
||||
/// Default: false
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub raw: Option<bool>,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub enable_safety_checker: Option<bool>,
|
||||
|
||||
/// "1" (most strict) to "5" (most permissive)
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub safety_tolerance: Option<String>,
|
||||
|
||||
/// "png" or "jpeg"
|
||||
/// Default: "jpeg"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub output_format: Option<String>,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub sync_mode: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct FluxPro11UltraTextToImageFile {
|
||||
pub url: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct FluxPro11UltraTextToImageOutput {
|
||||
pub images: Vec<FluxPro11UltraTextToImageFile>,
|
||||
}
|
||||
|
||||
pub fn flux_pro_11_ultra_text_to_image(
|
||||
params: FluxPro11UltraTextToImageInput,
|
||||
) -> FalRequest<FluxPro11UltraTextToImageInput, FluxPro11UltraTextToImageOutput> {
|
||||
FalRequest::new("fal-ai/flux-pro/v1.1-ultra", params)
|
||||
}
|
||||
+9
-8
@@ -1,33 +1,34 @@
|
||||
use crate::prelude::{Deserialize, FalRequest, Serialize};
|
||||
use crate::requests::api::fal_request::FalRequest;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
pub struct Gemini25FlashTextToImageInput {
|
||||
pub prompt: String,
|
||||
|
||||
/// 1 - 4
|
||||
/// Default: 1
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub num_images: Option<u8>,
|
||||
|
||||
/// "jpeg" or "png"
|
||||
/// Default: "png"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub output_format: Option<String>,
|
||||
|
||||
/// The aspect ratio of the generated image.
|
||||
/// Default value: "1:1"
|
||||
/// Possible enum values: 21:9, 16:9, 3:2, 4:3, 5:4, 1:1, 4:5, 3:4, 2:3, 9:16
|
||||
/// Options: 21:9, 16:9, 3:2, 4:3, 5:4, 1:1, 4:5, 3:4, 2:3, 9:16
|
||||
/// Default: "1:1"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub aspect_ratio: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
pub struct File {
|
||||
/// The URL where the file can be downloaded from.
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct Gemini25FlashTextToImageFile {
|
||||
pub url: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct Gemini25FlashTextToImageOutput {
|
||||
pub images: Vec<File>,
|
||||
pub images: Vec<Gemini25FlashTextToImageFile>,
|
||||
}
|
||||
|
||||
pub fn gemini_25_flash_text_to_image(
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
use crate::requests::api::fal_request::FalRequest;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
pub struct GptImage1TextToImageInput {
|
||||
pub prompt: String,
|
||||
|
||||
/// "auto", "1024x1024", "1536x1024", "1024x1536"
|
||||
pub image_size: String,
|
||||
|
||||
/// 1 - 4
|
||||
pub num_images: u8,
|
||||
|
||||
/// "auto", "low", "medium", "high"
|
||||
pub quality: String,
|
||||
|
||||
/// BYOK - caller supplies their own OpenAI API key
|
||||
pub openai_api_key: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct GptImage1TextToImageOutput {
|
||||
// Response fields parsed elsewhere
|
||||
}
|
||||
|
||||
pub fn gpt_image_1_text_to_image(
|
||||
params: GptImage1TextToImageInput,
|
||||
) -> FalRequest<GptImage1TextToImageInput, GptImage1TextToImageOutput> {
|
||||
FalRequest::new("fal-ai/gpt-image-1/text-to-image/byok", params)
|
||||
}
|
||||
+11
-9
@@ -1,39 +1,41 @@
|
||||
use crate::prelude::{Deserialize, FalRequest, Serialize};
|
||||
use crate::requests::api::fal_request::FalRequest;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
pub struct GptImage1p5TextToImageInput {
|
||||
pub prompt: String,
|
||||
|
||||
/// Eg. auto, 1024x1024, 1536x1024, 1024x1536
|
||||
/// "auto", "1024x1024", "1536x1024", "1024x1536"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub image_size: Option<String>,
|
||||
|
||||
/// Eg. Possible enum values: auto, transparent, opaque
|
||||
/// "auto", "transparent", "opaque"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub background: Option<String>,
|
||||
|
||||
/// Eg. Possible enum values: low, medium, high
|
||||
/// "low", "medium", "high"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub quality: Option<String>,
|
||||
|
||||
/// 1 - 4
|
||||
/// Default: 1
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub num_images: Option<u8>,
|
||||
|
||||
/// Possible enum values: jpeg, png, webp
|
||||
/// "jpeg", "png", "webp"
|
||||
/// Default: "png"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub output_format: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
pub struct ImageFile {
|
||||
/// The URL where the file can be downloaded from.
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct GptImage1p5TextToImageFile {
|
||||
pub url: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct GptImage1p5TextToImageOutput {
|
||||
pub images: Vec<ImageFile>,
|
||||
pub images: Vec<GptImage1p5TextToImageFile>,
|
||||
}
|
||||
|
||||
pub fn gpt_image_1p5_text_to_image(
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
use fal::request::FalRequest;
|
||||
use crate::requests::api::fal_request::FalRequest;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
+11
-7
@@ -1,35 +1,39 @@
|
||||
use crate::prelude::{Deserialize, FalRequest, Serialize};
|
||||
use crate::requests::api::fal_request::FalRequest;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
pub struct NanoBananaProTextToImageInput {
|
||||
pub prompt: String,
|
||||
|
||||
/// Eg. "16:9", "1:1", and a ton of other options. So many options.
|
||||
/// Options: auto, 21:9, 16:9, 3:2, 4:3, 5:4, 1:1, 4:5, 3:4, 2:3, 9:16
|
||||
/// Default: "auto"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub aspect_ratio: Option<String>,
|
||||
|
||||
/// Eg. "1K", "2K", "4K"
|
||||
/// "1K", "2K", "4K"
|
||||
/// Default: "1K"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub resolution: Option<String>,
|
||||
|
||||
/// 1 - 4
|
||||
/// Default: 1
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub num_images: Option<u8>,
|
||||
|
||||
/// "jpeg", "png", "webp"
|
||||
/// Default: "png"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub output_format: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
pub struct ImageFile {
|
||||
/// The URL where the file can be downloaded from.
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct NanoBananaProTextToImageFile {
|
||||
pub url: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct NanoBananaProTextToImageOutput {
|
||||
pub images: Vec<ImageFile>,
|
||||
pub images: Vec<NanoBananaProTextToImageFile>,
|
||||
}
|
||||
|
||||
pub fn nano_banana_pro_text_to_image(
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
use crate::requests::api::fal_request::FalRequest;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
pub struct SeedreamV4TextToImageInput {
|
||||
pub prompt: String,
|
||||
|
||||
/// Options: square_hd, square, portrait_4_3, portrait_16_9, landscape_4_3, landscape_16_9, auto, auto_2K, auto_4K
|
||||
/// Default: "auto_2K"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub image_size: Option<String>,
|
||||
|
||||
/// 1 - 4
|
||||
/// Default: 1
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub num_images: Option<u8>,
|
||||
|
||||
/// 1 - 4
|
||||
/// Default: 1
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub max_images: Option<u8>,
|
||||
|
||||
/// Enum: "standard", "fast"
|
||||
/// Default: "standard"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub enhance_prompt_mode: Option<String>,
|
||||
|
||||
/// Default: true
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub enable_safety_checker: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct SeedreamV4TextToImageFile {
|
||||
pub url: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct SeedreamV4TextToImageOutput {
|
||||
pub images: Vec<SeedreamV4TextToImageFile>,
|
||||
}
|
||||
|
||||
pub fn seedream_4_text_to_image(
|
||||
params: SeedreamV4TextToImageInput,
|
||||
) -> FalRequest<SeedreamV4TextToImageInput, SeedreamV4TextToImageOutput> {
|
||||
FalRequest::new("fal-ai/bytedance/seedream/v4/text-to-image", params)
|
||||
}
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
use crate::requests::api::fal_request::FalRequest;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
pub struct SeedreamV4p5TextToImageInput {
|
||||
pub prompt: String,
|
||||
|
||||
/// Options: square_hd, square, portrait_4_3, portrait_16_9, landscape_4_3, landscape_16_9, auto_2K, auto_4K
|
||||
/// Default: "auto_2K"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub image_size: Option<String>,
|
||||
|
||||
/// 1 - 4
|
||||
/// Default: 1
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub num_images: Option<u8>,
|
||||
|
||||
/// 1 - 4
|
||||
/// Default: 1
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub max_images: Option<u8>,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub seed: Option<i64>,
|
||||
|
||||
/// Default: true
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub enable_safety_checker: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct SeedreamV4p5TextToImageFile {
|
||||
pub url: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct SeedreamV4p5TextToImageOutput {
|
||||
pub images: Vec<SeedreamV4p5TextToImageFile>,
|
||||
}
|
||||
|
||||
pub fn seedream_4p5_text_to_image(
|
||||
params: SeedreamV4p5TextToImageInput,
|
||||
) -> FalRequest<SeedreamV4p5TextToImageInput, SeedreamV4p5TextToImageOutput> {
|
||||
FalRequest::new("fal-ai/bytedance/seedream/v4.5/text-to-image", params)
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
use fal::request::FalRequest;
|
||||
use crate::requests::api::fal_request::FalRequest;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
@@ -0,0 +1,12 @@
|
||||
pub mod http_flux_1_dev_text_to_image;
|
||||
pub mod http_flux_1_schnell_text_to_image;
|
||||
pub mod http_flux_pro_11_text_to_image;
|
||||
pub mod http_flux_pro_11_ultra_text_to_image;
|
||||
pub mod http_gemini_25_flash_text_to_image;
|
||||
pub mod http_gpt_image_1_text_to_image;
|
||||
pub mod http_gpt_image_1p5_text_to_image;
|
||||
pub mod http_nano_banana_2_text_to_image;
|
||||
pub mod http_nano_banana_pro_text_to_image;
|
||||
pub mod http_seedream_4_text_to_image;
|
||||
pub mod http_seedream_4p5_text_to_image;
|
||||
pub mod http_seedream_5_text_to_image;
|
||||
@@ -1,2 +1,3 @@
|
||||
pub mod image;
|
||||
pub mod object;
|
||||
pub mod video;
|
||||
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
use crate::requests::api::fal_request::FalRequest;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
pub struct Hunyuan3dV21ImageTo3dInput {
|
||||
pub input_image_url: String,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub textured_mesh: Option<bool>,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub guidance_scale: Option<f64>,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub num_inference_steps: Option<i64>,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub octree_resolution: Option<i64>,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub seed: Option<i64>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct Hunyuan3dV21ImageTo3dOutput {}
|
||||
|
||||
pub fn hunyuan3d_v21_image_to_3d(
|
||||
params: Hunyuan3dV21ImageTo3dInput,
|
||||
) -> FalRequest<Hunyuan3dV21ImageTo3dInput, Hunyuan3dV21ImageTo3dOutput> {
|
||||
FalRequest::new("fal-ai/hunyuan3d-v21", params)
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
use crate::requests::api::fal_request::FalRequest;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
pub struct Hunyuan3dV2ImageTo3dInput {
|
||||
pub input_image_url: String,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub textured_mesh: Option<bool>,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub guidance_scale: Option<f64>,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub num_inference_steps: Option<i64>,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub octree_resolution: Option<i64>,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub seed: Option<i64>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct Hunyuan3dV2ImageTo3dOutput {}
|
||||
|
||||
pub fn hunyuan3d_v2_image_to_3d(
|
||||
params: Hunyuan3dV2ImageTo3dInput,
|
||||
) -> FalRequest<Hunyuan3dV2ImageTo3dInput, Hunyuan3dV2ImageTo3dOutput> {
|
||||
FalRequest::new("fal-ai/hunyuan3d/v2", params)
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
use crate::requests::api::fal_request::FalRequest;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
pub struct Hunyuan3dV3ImageTo3dInput {
|
||||
pub input_image_url: String,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub back_image_url: Option<String>,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub left_image_url: Option<String>,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub right_image_url: Option<String>,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub face_count: Option<u32>,
|
||||
|
||||
/// Options: "Normal", "LowPoly", "Geometry"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub generate_type: Option<String>,
|
||||
|
||||
/// Options: "triangle", "quadrilateral"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub polygon_type: Option<String>,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub enable_pbr: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct Hunyuan3dV3ImageTo3dOutput {}
|
||||
|
||||
pub fn hunyuan3d_v3_image_to_3d(
|
||||
params: Hunyuan3dV3ImageTo3dInput,
|
||||
) -> FalRequest<Hunyuan3dV3ImageTo3dInput, Hunyuan3dV3ImageTo3dOutput> {
|
||||
FalRequest::new("fal-ai/hunyuan3d-v3/image-to-3d", params)
|
||||
}
|
||||
+5
-19
@@ -1,43 +1,29 @@
|
||||
use crate::prelude::{Deserialize, FalRequest, Serialize};
|
||||
use crate::requests::api::fal_request::FalRequest;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
pub struct Hunyuan3dV3SketchTo3dInput {
|
||||
/// REQUIRED
|
||||
pub prompt: String,
|
||||
|
||||
/// REQUIRED
|
||||
pub input_image_url: String,
|
||||
|
||||
/// Target face count. Range: 40000-1500000 Default value: 500000
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub face_count: Option<u32>,
|
||||
|
||||
/// Options: "Normal", "LowPoly", "Geometry"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub generate_type: Option<String>,
|
||||
|
||||
/// Options: "triangle", "quadrilateral"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub polygon_type: Option<String>,
|
||||
|
||||
/// Whether to enable PBR material generation.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub enable_pbr: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct Hunyuan3dV3SketchTo3dOutput {
|
||||
pub model_glb: Hunyuan3dV3SketchTo3dModelGlb,
|
||||
pub thumbnail: Hunyuan3dV3SketchTo3dThumbnail,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct Hunyuan3dV3SketchTo3dModelGlb {
|
||||
pub url: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct Hunyuan3dV3SketchTo3dThumbnail {
|
||||
pub url: String,
|
||||
}
|
||||
pub struct Hunyuan3dV3SketchTo3dOutput {}
|
||||
|
||||
pub fn hunyuan3d_v3_sketch_to_3d(
|
||||
params: Hunyuan3dV3SketchTo3dInput,
|
||||
+5
-18
@@ -1,40 +1,27 @@
|
||||
use crate::prelude::{Deserialize, FalRequest, Serialize};
|
||||
use crate::requests::api::fal_request::FalRequest;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
pub struct Hunyuan3dV3TextTo3dInput {
|
||||
/// REQUIRED
|
||||
pub prompt: String,
|
||||
|
||||
/// Target face count. Range: 40000-1500000 Default value: 500000
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub face_count: Option<u32>,
|
||||
|
||||
/// Options: "Normal", "LowPoly", "Geometry"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub generate_type: Option<String>,
|
||||
|
||||
/// Options: "triangle", "quadrilateral"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub polygon_type: Option<String>,
|
||||
|
||||
/// Whether to enable PBR material generation.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub enable_pbr: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct Hunyuan3dV3TextTo3dOutput {
|
||||
pub model_glb: Hunyuan3dV3TextTo3dModelGlb,
|
||||
pub thumbnail: Hunyuan3dV3TextTo3dThumbnail,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct Hunyuan3dV3TextTo3dModelGlb {
|
||||
pub url: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct Hunyuan3dV3TextTo3dThumbnail {
|
||||
pub url: String,
|
||||
}
|
||||
pub struct Hunyuan3dV3TextTo3dOutput {}
|
||||
|
||||
pub fn hunyuan3d_v3_text_to_3d(
|
||||
params: Hunyuan3dV3TextTo3dInput,
|
||||
@@ -0,0 +1,5 @@
|
||||
pub mod http_hunyuan3d_v2_image_to_3d;
|
||||
pub mod http_hunyuan3d_v21_image_to_3d;
|
||||
pub mod http_hunyuan3d_v3_image_to_3d;
|
||||
pub mod http_hunyuan3d_v3_sketch_to_3d;
|
||||
pub mod http_hunyuan3d_v3_text_to_3d;
|
||||
+7
-9
@@ -1,26 +1,24 @@
|
||||
use crate::prelude::{Deserialize, FalRequest, Serialize};
|
||||
use crate::requests::api::fal_request::FalRequest;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
pub struct HailuoV2p3FastProImageToVideoInput {
|
||||
pub prompt: String,
|
||||
|
||||
/// Starting frame
|
||||
pub image_url: String,
|
||||
|
||||
/// Default value: true
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub prompt_optimizer: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct HailuoV2p3FastProImageToVideoOutput {
|
||||
pub video: VideoFile,
|
||||
pub struct HailuoV2p3FastProImageToVideoVideoFile {
|
||||
pub url: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
pub struct VideoFile {
|
||||
/// The URL where the file can be downloaded from.
|
||||
pub url: String,
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct HailuoV2p3FastProImageToVideoOutput {
|
||||
pub video: HailuoV2p3FastProImageToVideoVideoFile,
|
||||
}
|
||||
|
||||
pub fn hailuo_v2p3_fast_pro_image_to_video(
|
||||
+7
-9
@@ -1,26 +1,24 @@
|
||||
use crate::prelude::{Deserialize, FalRequest, Serialize};
|
||||
use crate::requests::api::fal_request::FalRequest;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
pub struct HailuoV2p3ProImageToVideoInput {
|
||||
pub prompt: String,
|
||||
|
||||
/// Starting frame
|
||||
pub image_url: String,
|
||||
|
||||
/// Default value: true
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub prompt_optimizer: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct HailuoV2p3ProImageToVideoOutput {
|
||||
pub video: VideoFile,
|
||||
pub struct HailuoV2p3ProImageToVideoVideoFile {
|
||||
pub url: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
pub struct VideoFile {
|
||||
/// The URL where the file can be downloaded from.
|
||||
pub url: String,
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct HailuoV2p3ProImageToVideoOutput {
|
||||
pub video: HailuoV2p3ProImageToVideoVideoFile,
|
||||
}
|
||||
|
||||
pub fn hailuo_v2p3_pro_image_to_video(
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
use fal::request::FalRequest;
|
||||
use crate::requests::api::fal_request::FalRequest;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
use fal::request::FalRequest;
|
||||
use crate::requests::api::fal_request::FalRequest;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
use crate::requests::api::fal_request::FalRequest;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
pub struct KlingV1p6ProImageToVideoInput {
|
||||
pub image_url: String,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub tail_image_url: Option<String>,
|
||||
|
||||
pub prompt: String,
|
||||
|
||||
/// Options: "16:9", "9:16", "1:1"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub aspect_ratio: Option<String>,
|
||||
|
||||
/// Options: "5", "10"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub duration: Option<String>,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub cfg_scale: Option<f32>,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub negative_prompt: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct KlingV1p6ProImageToVideoVideoFile {
|
||||
pub url: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct KlingV1p6ProImageToVideoOutput {
|
||||
pub video: KlingV1p6ProImageToVideoVideoFile,
|
||||
}
|
||||
|
||||
pub fn kling_v1p6_pro_image_to_video(
|
||||
params: KlingV1p6ProImageToVideoInput,
|
||||
) -> FalRequest<KlingV1p6ProImageToVideoInput, KlingV1p6ProImageToVideoOutput> {
|
||||
FalRequest::new("fal-ai/kling-video/v1.6/pro/image-to-video", params)
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
use crate::requests::api::fal_request::FalRequest;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
pub struct KlingV2p1MasterImageToVideoInput {
|
||||
pub image_url: String,
|
||||
|
||||
pub prompt: String,
|
||||
|
||||
/// Options: "16:9", "9:16", "1:1"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub aspect_ratio: Option<String>,
|
||||
|
||||
/// Options: "5", "10"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub duration: Option<String>,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub cfg_scale: Option<f32>,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub negative_prompt: Option<String>,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub tail_image_url: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct KlingV2p1MasterImageToVideoVideoFile {
|
||||
pub url: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct KlingV2p1MasterImageToVideoOutput {
|
||||
pub video: KlingV2p1MasterImageToVideoVideoFile,
|
||||
}
|
||||
|
||||
pub fn kling_v2p1_master_image_to_video(
|
||||
params: KlingV2p1MasterImageToVideoInput,
|
||||
) -> FalRequest<KlingV2p1MasterImageToVideoInput, KlingV2p1MasterImageToVideoOutput> {
|
||||
FalRequest::new("fal-ai/kling-video/v2.1/master/image-to-video", params)
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
use crate::requests::api::fal_request::FalRequest;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
pub struct KlingV2p1ProImageToVideoInput {
|
||||
pub image_url: String,
|
||||
|
||||
pub prompt: String,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub tail_image_url: Option<String>,
|
||||
|
||||
/// Options: "16:9", "9:16", "1:1"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub aspect_ratio: Option<String>,
|
||||
|
||||
/// Options: "5", "10"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub duration: Option<String>,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub cfg_scale: Option<f32>,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub negative_prompt: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct KlingV2p1ProImageToVideoVideoFile {
|
||||
pub url: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct KlingV2p1ProImageToVideoOutput {
|
||||
pub video: KlingV2p1ProImageToVideoVideoFile,
|
||||
}
|
||||
|
||||
pub fn kling_v2p1_pro_image_to_video(
|
||||
params: KlingV2p1ProImageToVideoInput,
|
||||
) -> FalRequest<KlingV2p1ProImageToVideoInput, KlingV2p1ProImageToVideoOutput> {
|
||||
FalRequest::new("fal-ai/kling-video/v2.1/pro/image-to-video", params)
|
||||
}
|
||||
+13
-20
@@ -1,41 +1,34 @@
|
||||
use crate::prelude::{Deserialize, FalRequest, Serialize};
|
||||
use crate::requests::api::fal_request::FalRequest;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
pub struct KlingV2p5TurboProImageToVideoInput {
|
||||
pub prompt: String,
|
||||
|
||||
/// Starting frame
|
||||
pub image_url: String,
|
||||
|
||||
/// Optional ending frame
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub tail_image_url: Option<String>,
|
||||
|
||||
/// Optional negative prompt
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub negative_prompt: Option<String>,
|
||||
|
||||
/// Duration in seconds
|
||||
/// Options: "5", "10"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub duration: Option<String>,
|
||||
|
||||
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want the model to
|
||||
/// stick to your prompt.
|
||||
/// Default value: 0.5
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub tail_image_url: Option<String>,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub negative_prompt: Option<String>,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub cfg_scale: Option<f32>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct KlingV2p5TurboProImageToVideoOutput {
|
||||
pub video: VideoFile,
|
||||
pub struct KlingV2p5TurboProImageToVideoVideoFile {
|
||||
pub url: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
pub struct VideoFile {
|
||||
/// The URL where the file can be downloaded from.
|
||||
pub url: String,
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct KlingV2p5TurboProImageToVideoOutput {
|
||||
pub video: KlingV2p5TurboProImageToVideoVideoFile,
|
||||
}
|
||||
|
||||
pub fn kling_v2p5_turbo_pro_image_to_video(
|
||||
+10
-16
@@ -1,37 +1,31 @@
|
||||
use crate::prelude::{Deserialize, FalRequest, Serialize};
|
||||
use crate::requests::api::fal_request::FalRequest;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
pub struct KlingV2p5TurboStandardImageToVideoInput {
|
||||
pub prompt: String,
|
||||
|
||||
/// Starting frame
|
||||
pub image_url: String,
|
||||
|
||||
/// Optional negative prompt
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub negative_prompt: Option<String>,
|
||||
|
||||
/// Duration in seconds
|
||||
/// Options: "5", "10"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub duration: Option<String>,
|
||||
|
||||
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want the model to
|
||||
/// stick to your prompt.
|
||||
/// Default value: 0.5
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub negative_prompt: Option<String>,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub cfg_scale: Option<f32>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct KlingV2p5TurboStandardImageToVideoOutput {
|
||||
pub video: VideoFile,
|
||||
pub struct KlingV2p5TurboStandardImageToVideoVideoFile {
|
||||
pub url: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
pub struct VideoFile {
|
||||
/// The URL where the file can be downloaded from.
|
||||
pub url: String,
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct KlingV2p5TurboStandardImageToVideoOutput {
|
||||
pub video: KlingV2p5TurboStandardImageToVideoVideoFile,
|
||||
}
|
||||
|
||||
pub fn kling_v2p5_turbo_standard_image_to_video(
|
||||
+14
-18
@@ -1,35 +1,31 @@
|
||||
use crate::prelude::{Deserialize, FalRequest, Serialize};
|
||||
use crate::requests::api::fal_request::FalRequest;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
pub struct KlingV2p6ProImageToVideoInput {
|
||||
pub prompt: String,
|
||||
|
||||
/// Starting frame
|
||||
pub image_url: String,
|
||||
|
||||
/// Generate audio
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub generate_audio: Option<bool>,
|
||||
|
||||
/// Optional negative prompt
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub negative_prompt: Option<String>,
|
||||
|
||||
/// Duration in seconds
|
||||
/// Options: "5", "10"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub duration: Option<String>,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub negative_prompt: Option<String>,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub generate_audio: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct KlingV2p6ProImageToVideoVideoFile {
|
||||
pub url: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct KlingV2p6ProImageToVideoOutput {
|
||||
pub video: VideoFile,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
pub struct VideoFile {
|
||||
/// The URL where the file can be downloaded from.
|
||||
pub url: String,
|
||||
pub video: KlingV2p6ProImageToVideoVideoFile,
|
||||
}
|
||||
|
||||
pub fn kling_v2p6_pro_image_to_video(
|
||||
+19
-28
@@ -1,52 +1,43 @@
|
||||
use crate::prelude::{Deserialize, FalRequest, Serialize};
|
||||
use crate::requests::api::fal_request::FalRequest;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
pub struct PixverseV5ImageToVideoInput {
|
||||
pub prompt: String,
|
||||
|
||||
/// Starting frame
|
||||
pub image_url: String,
|
||||
|
||||
/// Resolution
|
||||
/// Possible enum values: 360p, 540p, 720p, 1080p
|
||||
/// Default is 720p
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub resolution: Option<String>,
|
||||
|
||||
/// The aspect ratio of the generated video
|
||||
/// Default value: "16:9"
|
||||
/// Possible enum values: 16:9, 4:3, 1:1, 3:4, 9:16
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub aspect_ratio: Option<String>,
|
||||
|
||||
/// Optional negative prompt
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub negative_prompt: Option<String>,
|
||||
|
||||
/// Duration in seconds
|
||||
/// Options: "5", "8"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub duration: Option<String>,
|
||||
|
||||
/// Optional style
|
||||
/// Possible enum values: anime, 3d_animation, clay, comic, cyberpunk
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub negative_prompt: Option<String>,
|
||||
|
||||
/// Options: "16:9", "4:3", "1:1", "3:4", "9:16"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub aspect_ratio: Option<String>,
|
||||
|
||||
/// Options: "360p", "540p", "720p", "1080p"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub resolution: Option<String>,
|
||||
|
||||
/// Options: "anime", "3d_animation", "clay", "comic", "cyberpunk"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub style: Option<String>,
|
||||
|
||||
/// Optional seed
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub seed: Option<i64>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct PixverseV5ImageToVideoOutput {
|
||||
pub video: VideoFile,
|
||||
pub struct PixverseV5ImageToVideoVideoFile {
|
||||
pub url: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
pub struct VideoFile {
|
||||
/// The URL where the file can be downloaded from.
|
||||
pub url: String,
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct PixverseV5ImageToVideoOutput {
|
||||
pub video: PixverseV5ImageToVideoVideoFile,
|
||||
}
|
||||
|
||||
pub fn pixverse_v5_image_to_video(
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
use crate::requests::api::fal_request::FalRequest;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
pub struct Seedance1LiteImageToVideoInput {
|
||||
pub image_url: String,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub end_image_url: Option<String>,
|
||||
|
||||
pub prompt: String,
|
||||
|
||||
/// Options: "5", "10"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub duration: Option<String>,
|
||||
|
||||
/// Options: "480p", "720p", "1080p"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub resolution: Option<String>,
|
||||
|
||||
/// Options: "16:9", "9:16", "1:1"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub aspect_ratio: Option<String>,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub camera_fixed: Option<bool>,
|
||||
|
||||
pub seed: i64,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub enable_safety_checker: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct Seedance1LiteImageToVideoVideoFile {
|
||||
pub url: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct Seedance1LiteImageToVideoOutput {
|
||||
pub video: Seedance1LiteImageToVideoVideoFile,
|
||||
}
|
||||
|
||||
pub fn seedance_1_lite_image_to_video(
|
||||
params: Seedance1LiteImageToVideoInput,
|
||||
) -> FalRequest<Seedance1LiteImageToVideoInput, Seedance1LiteImageToVideoOutput> {
|
||||
FalRequest::new("fal-ai/bytedance/seedance/v1/lite/image-to-video", params)
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
use crate::requests::api::fal_request::FalRequest;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
pub struct Seedance1ProImageToVideoInput {
|
||||
pub image_url: String,
|
||||
|
||||
pub prompt: String,
|
||||
|
||||
/// Options: "5", "10"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub duration: Option<String>,
|
||||
|
||||
/// Options: "480p", "720p", "1080p"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub resolution: Option<String>,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub camera_fixed: Option<bool>,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub enable_safety_checker: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct Seedance1ProImageToVideoVideoFile {
|
||||
pub url: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct Seedance1ProImageToVideoOutput {
|
||||
pub video: Seedance1ProImageToVideoVideoFile,
|
||||
}
|
||||
|
||||
pub fn seedance_1_pro_image_to_video(
|
||||
params: Seedance1ProImageToVideoInput,
|
||||
) -> FalRequest<Seedance1ProImageToVideoInput, Seedance1ProImageToVideoOutput> {
|
||||
FalRequest::new("fal-ai/bytedance/seedance/v1/pro/image-to-video", params)
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
use fal::request::FalRequest;
|
||||
use crate::requests::api::fal_request::FalRequest;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
use fal::request::FalRequest;
|
||||
use crate::requests::api::fal_request::FalRequest;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
use fal::request::FalRequest;
|
||||
use crate::requests::api::fal_request::FalRequest;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
use crate::requests::api::fal_request::FalRequest;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
pub struct Veo2ImageToVideoInput {
|
||||
pub image_url: String,
|
||||
|
||||
pub prompt: String,
|
||||
|
||||
/// Options: "auto", "16:9", "9:16"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub aspect_ratio: Option<String>,
|
||||
|
||||
/// Options: "4s", "6s", "8s"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub duration: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct Veo2ImageToVideoVideoFile {
|
||||
pub url: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct Veo2ImageToVideoOutput {
|
||||
pub video: Veo2ImageToVideoVideoFile,
|
||||
}
|
||||
|
||||
pub fn veo_2_image_to_video(
|
||||
params: Veo2ImageToVideoInput,
|
||||
) -> FalRequest<Veo2ImageToVideoInput, Veo2ImageToVideoOutput> {
|
||||
FalRequest::new("fal-ai/veo2/image-to-video", params)
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
use crate::requests::api::fal_request::FalRequest;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
pub struct Veo3FastImageToVideoInput {
|
||||
pub image_url: String,
|
||||
|
||||
pub prompt: String,
|
||||
|
||||
/// Options: "720p", "1080p"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub resolution: Option<String>,
|
||||
|
||||
/// Options: "4s", "6s", "8s"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub duration: Option<String>,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub generate_audio: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct Veo3FastImageToVideoVideoFile {
|
||||
pub url: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct Veo3FastImageToVideoOutput {
|
||||
pub video: Veo3FastImageToVideoVideoFile,
|
||||
}
|
||||
|
||||
pub fn veo_3_fast_image_to_video(
|
||||
params: Veo3FastImageToVideoInput,
|
||||
) -> FalRequest<Veo3FastImageToVideoInput, Veo3FastImageToVideoOutput> {
|
||||
FalRequest::new("fal-ai/veo3/fast/image-to-video", params)
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
use crate::requests::api::fal_request::FalRequest;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
pub struct Veo3ImageToVideoInput {
|
||||
pub image_url: String,
|
||||
|
||||
pub prompt: String,
|
||||
|
||||
/// Options: "auto", "16:9", "9:16"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub aspect_ratio: Option<String>,
|
||||
|
||||
/// Options: "720p", "1080p"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub resolution: Option<String>,
|
||||
|
||||
/// Options: "4s", "6s", "8s"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub duration: Option<String>,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub generate_audio: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct Veo3ImageToVideoVideoFile {
|
||||
pub url: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct Veo3ImageToVideoOutput {
|
||||
pub video: Veo3ImageToVideoVideoFile,
|
||||
}
|
||||
|
||||
pub fn veo_3_image_to_video(
|
||||
params: Veo3ImageToVideoInput,
|
||||
) -> FalRequest<Veo3ImageToVideoInput, Veo3ImageToVideoOutput> {
|
||||
FalRequest::new("fal-ai/veo3/image-to-video", params)
|
||||
}
|
||||
+13
-21
@@ -1,46 +1,38 @@
|
||||
use crate::prelude::{Deserialize, FalRequest, Serialize};
|
||||
use crate::requests::api::fal_request::FalRequest;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
pub struct Veo3p1FastFirstLastFrameImageToVideoInput {
|
||||
pub prompt: String,
|
||||
|
||||
/// Starting frame
|
||||
pub first_frame_url: String,
|
||||
|
||||
/// Ending frame
|
||||
pub last_frame_url: String,
|
||||
|
||||
/// Duration in seconds
|
||||
/// Possible enum values: 4s, 6s, 8s
|
||||
/// Default value 8s
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub generate_audio: Option<bool>,
|
||||
|
||||
/// Options: "4s", "6s", "8s"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub duration: Option<String>,
|
||||
|
||||
/// Possible enum values: auto, 9:16, 16:9, 1:1
|
||||
/// Default value "auto"
|
||||
/// Options: "auto", "16:9", "9:16"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub aspect_ratio: Option<String>,
|
||||
|
||||
/// Possible enum values: 720p, 1080p
|
||||
/// Default value 720p
|
||||
/// Options: "720p", "1080p"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub resolution: Option<String>,
|
||||
}
|
||||
|
||||
/// Generate audio
|
||||
/// Defaults to "true"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub generate_audio: Option<bool>,
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct Veo3p1FastFirstLastFrameImageToVideoVideoFile {
|
||||
pub url: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct Veo3p1FastFirstLastFrameImageToVideoOutput {
|
||||
pub video: VideoFile,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
pub struct VideoFile {
|
||||
/// The URL where the file can be downloaded from.
|
||||
pub url: String,
|
||||
pub video: Veo3p1FastFirstLastFrameImageToVideoVideoFile,
|
||||
}
|
||||
|
||||
pub fn veo_3p1_fast_first_last_frame_image_to_video(
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
use crate::requests::api::fal_request::FalRequest;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
pub struct Veo3p1FastImageToVideoInput {
|
||||
pub prompt: String,
|
||||
|
||||
pub image_url: String,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub generate_audio: Option<bool>,
|
||||
|
||||
/// Options: "4s", "6s", "8s"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub duration: Option<String>,
|
||||
|
||||
/// Options: "auto", "16:9", "9:16"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub aspect_ratio: Option<String>,
|
||||
|
||||
/// Options: "720p", "1080p"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub resolution: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct Veo3p1FastImageToVideoVideoFile {
|
||||
pub url: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct Veo3p1FastImageToVideoOutput {
|
||||
pub video: Veo3p1FastImageToVideoVideoFile,
|
||||
}
|
||||
|
||||
pub fn veo_3p1_fast_image_to_video(
|
||||
params: Veo3p1FastImageToVideoInput,
|
||||
) -> FalRequest<Veo3p1FastImageToVideoInput, Veo3p1FastImageToVideoOutput> {
|
||||
FalRequest::new("fal-ai/veo3.1/fast/image-to-video", params)
|
||||
}
|
||||
+13
-21
@@ -1,46 +1,38 @@
|
||||
use crate::prelude::{Deserialize, FalRequest, Serialize};
|
||||
use crate::requests::api::fal_request::FalRequest;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
pub struct Veo3p1FirstLastFrameImageToVideoInput {
|
||||
pub prompt: String,
|
||||
|
||||
/// Starting frame
|
||||
pub first_frame_url: String,
|
||||
|
||||
/// Ending frame
|
||||
pub last_frame_url: String,
|
||||
|
||||
/// Duration in seconds
|
||||
/// Possible enum values: 4s, 6s, 8s
|
||||
/// Default value 8s
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub generate_audio: Option<bool>,
|
||||
|
||||
/// Options: "4s", "6s", "8s"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub duration: Option<String>,
|
||||
|
||||
/// Possible enum values: auto, 9:16, 16:9, 1:1
|
||||
/// Default value "auto"
|
||||
/// Options: "auto", "16:9", "9:16"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub aspect_ratio: Option<String>,
|
||||
|
||||
/// Possible enum values: 720p, 1080p
|
||||
/// Default value 720p
|
||||
/// Options: "720p", "1080p"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub resolution: Option<String>,
|
||||
}
|
||||
|
||||
/// Generate audio
|
||||
/// Defaults to "true"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub generate_audio: Option<bool>,
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct Veo3p1FirstLastFrameImageToVideoVideoFile {
|
||||
pub url: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct Veo3p1FirstLastFrameImageToVideoOutput {
|
||||
pub video: VideoFile,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
pub struct VideoFile {
|
||||
/// The URL where the file can be downloaded from.
|
||||
pub url: String,
|
||||
pub video: Veo3p1FirstLastFrameImageToVideoVideoFile,
|
||||
}
|
||||
|
||||
pub fn veo_3p1_first_last_frame_image_to_video(
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
use crate::requests::api::fal_request::FalRequest;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
pub struct Veo3p1ImageToVideoInput {
|
||||
pub prompt: String,
|
||||
|
||||
pub image_url: String,
|
||||
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub generate_audio: Option<bool>,
|
||||
|
||||
/// Options: "4s", "6s", "8s"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub duration: Option<String>,
|
||||
|
||||
/// Options: "auto", "16:9", "9:16"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub aspect_ratio: Option<String>,
|
||||
|
||||
/// Options: "720p", "1080p"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub resolution: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct Veo3p1ImageToVideoVideoFile {
|
||||
pub url: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct Veo3p1ImageToVideoOutput {
|
||||
pub video: Veo3p1ImageToVideoVideoFile,
|
||||
}
|
||||
|
||||
pub fn veo_3p1_image_to_video(
|
||||
params: Veo3p1ImageToVideoInput,
|
||||
) -> FalRequest<Veo3p1ImageToVideoInput, Veo3p1ImageToVideoOutput> {
|
||||
FalRequest::new("fal-ai/veo3.1/image-to-video", params)
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
pub mod http_hailuo_v2p3_fast_pro_image_to_video;
|
||||
pub mod http_hailuo_v2p3_pro_image_to_video;
|
||||
pub mod http_kling_3p0_pro_image_to_video;
|
||||
pub mod http_kling_3p0_standard_image_to_video;
|
||||
pub mod http_kling_v1p6_pro_image_to_video;
|
||||
pub mod http_kling_v2p1_master_image_to_video;
|
||||
pub mod http_kling_v2p1_pro_image_to_video;
|
||||
pub mod http_kling_v2p5_turbo_pro_image_to_video;
|
||||
pub mod http_kling_v2p5_turbo_standard_image_to_video;
|
||||
pub mod http_kling_v2p6_pro_image_to_video;
|
||||
pub mod http_pixverse_v5_image_to_video;
|
||||
pub mod http_seedance_1_lite_image_to_video;
|
||||
pub mod http_seedance_1_pro_image_to_video;
|
||||
pub mod http_seedance_1p5_pro_image_to_video;
|
||||
pub mod http_sora_2_image_to_video;
|
||||
pub mod http_sora_2_pro_image_to_video;
|
||||
pub mod http_veo_2_image_to_video;
|
||||
pub mod http_veo_3_fast_image_to_video;
|
||||
pub mod http_veo_3_image_to_video;
|
||||
pub mod http_veo_3p1_fast_first_last_frame_image_to_video;
|
||||
pub mod http_veo_3p1_fast_image_to_video;
|
||||
pub mod http_veo_3p1_first_last_frame_image_to_video;
|
||||
pub mod http_veo_3p1_image_to_video;
|
||||
@@ -1,10 +1,2 @@
|
||||
pub mod http_kling_3p0_pro_image_to_video;
|
||||
pub mod http_kling_3p0_pro_text_to_video;
|
||||
pub mod http_kling_3p0_standard_image_to_video;
|
||||
pub mod http_kling_3p0_standard_text_to_video;
|
||||
pub mod http_seedance_1p5_pro_image_to_video;
|
||||
pub mod http_seedance_1p5_pro_text_to_video;
|
||||
pub mod http_sora_2_text_to_video;
|
||||
pub mod http_sora_2_image_to_video;
|
||||
pub mod http_sora_2_pro_text_to_video;
|
||||
pub mod http_sora_2_pro_image_to_video;
|
||||
pub mod image;
|
||||
pub mod text;
|
||||
|
||||
+7
-8
@@ -1,23 +1,22 @@
|
||||
use crate::prelude::{Deserialize, FalRequest, Serialize};
|
||||
use crate::requests::api::fal_request::FalRequest;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
pub struct HailuoV2p3ProTextToVideoInput {
|
||||
pub prompt: String,
|
||||
|
||||
/// Default value: true
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub prompt_optimizer: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct HailuoV2p3ProTextToVideoOutput {
|
||||
pub video: VideoFile,
|
||||
pub struct HailuoV2p3ProTextToVideoVideoFile {
|
||||
pub url: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
pub struct VideoFile {
|
||||
/// The URL where the file can be downloaded from.
|
||||
pub url: String,
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct HailuoV2p3ProTextToVideoOutput {
|
||||
pub video: HailuoV2p3ProTextToVideoVideoFile,
|
||||
}
|
||||
|
||||
pub fn hailuo_v2p3_pro_text_to_video(
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
use fal::request::FalRequest;
|
||||
use crate::requests::api::fal_request::FalRequest;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
use fal::request::FalRequest;
|
||||
use crate::requests::api::fal_request::FalRequest;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
+9
-10
@@ -1,11 +1,12 @@
|
||||
use crate::prelude::{Deserialize, FalRequest, Serialize};
|
||||
use crate::requests::api::fal_request::FalRequest;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
pub struct KlingV2p5TurboProTextToVideoInput {
|
||||
pub prompt: String,
|
||||
|
||||
/// Aspect ratio
|
||||
/// Possible enum values: "16:9", "9:16", "1:1"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub aspect_ratio: Option<String>,
|
||||
|
||||
/// Optional negative prompt
|
||||
@@ -17,22 +18,20 @@ pub struct KlingV2p5TurboProTextToVideoInput {
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub duration: Option<String>,
|
||||
|
||||
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want the model to
|
||||
/// stick to your prompt.
|
||||
/// The CFG (Classifier Free Guidance) scale.
|
||||
/// Default value: 0.5
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub cfg_scale: Option<f32>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct KlingV2p5TurboProTextToVideoOutput {
|
||||
pub video: VideoFile,
|
||||
pub struct KlingV2p5TurboProTextToVideoVideoFile {
|
||||
pub url: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
pub struct VideoFile {
|
||||
/// The URL where the file can be downloaded from.
|
||||
pub url: String,
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct KlingV2p5TurboProTextToVideoOutput {
|
||||
pub video: KlingV2p5TurboProTextToVideoVideoFile,
|
||||
}
|
||||
|
||||
pub fn kling_v2p5_turbo_pro_text_to_video(
|
||||
+9
-10
@@ -1,11 +1,12 @@
|
||||
use crate::prelude::{Deserialize, FalRequest, Serialize};
|
||||
use crate::requests::api::fal_request::FalRequest;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
pub struct KlingV2p6ProTextToVideoInput {
|
||||
pub prompt: String,
|
||||
|
||||
/// Aspect ratio
|
||||
/// Possible enum values: "16:9", "9:16", "1:1"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub aspect_ratio: Option<String>,
|
||||
|
||||
/// Generate audio
|
||||
@@ -21,22 +22,20 @@ pub struct KlingV2p6ProTextToVideoInput {
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub duration: Option<String>,
|
||||
|
||||
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want the model to
|
||||
/// stick to your prompt.
|
||||
/// The CFG (Classifier Free Guidance) scale.
|
||||
/// Default value: 0.5
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub cfg_scale: Option<f32>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct KlingV2p6ProTextToVideoOutput {
|
||||
pub video: VideoFile,
|
||||
pub struct KlingV2p6ProTextToVideoVideoFile {
|
||||
pub url: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
pub struct VideoFile {
|
||||
/// The URL where the file can be downloaded from.
|
||||
pub url: String,
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct KlingV2p6ProTextToVideoOutput {
|
||||
pub video: KlingV2p6ProTextToVideoVideoFile,
|
||||
}
|
||||
|
||||
pub fn kling_v2p6_pro_text_to_video(
|
||||
+10
-16
@@ -1,18 +1,15 @@
|
||||
use crate::prelude::{Deserialize, FalRequest, Serialize};
|
||||
use crate::requests::api::fal_request::FalRequest;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
pub struct PixverseV5TextToVideoInput {
|
||||
pub prompt: String,
|
||||
|
||||
/// Resolution
|
||||
/// Possible enum values: 360p, 540p, 720p, 1080p
|
||||
/// Default is 720p
|
||||
/// Options: "360p", "540p", "720p", "1080p"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub resolution: Option<String>,
|
||||
|
||||
/// The aspect ratio of the generated video
|
||||
/// Default value: "16:9"
|
||||
/// Possible enum values: 16:9, 4:3, 1:1, 3:4, 9:16
|
||||
/// Options: "16:9", "4:3", "1:1", "3:4", "9:16"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub aspect_ratio: Option<String>,
|
||||
|
||||
@@ -25,25 +22,22 @@ pub struct PixverseV5TextToVideoInput {
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub duration: Option<String>,
|
||||
|
||||
/// Optional style
|
||||
/// Possible enum values: anime, 3d_animation, clay, comic, cyberpunk
|
||||
/// Options: "anime", "3d_animation", "clay", "comic", "cyberpunk"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub style: Option<String>,
|
||||
|
||||
/// Optional seed
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub seed: Option<i64>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct PixverseV5TextToVideoOutput {
|
||||
pub video: VideoFile,
|
||||
pub struct PixverseV5TextToVideoVideoFile {
|
||||
pub url: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
pub struct VideoFile {
|
||||
/// The URL where the file can be downloaded from.
|
||||
pub url: String,
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct PixverseV5TextToVideoOutput {
|
||||
pub video: PixverseV5TextToVideoVideoFile,
|
||||
}
|
||||
|
||||
pub fn pixverse_v5_text_to_video(
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
use fal::request::FalRequest;
|
||||
use crate::requests::api::fal_request::FalRequest;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
use fal::request::FalRequest;
|
||||
use crate::requests::api::fal_request::FalRequest;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
use fal::request::FalRequest;
|
||||
use crate::requests::api::fal_request::FalRequest;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
+11
-18
@@ -1,20 +1,19 @@
|
||||
use crate::prelude::{Deserialize, FalRequest, Serialize};
|
||||
use crate::requests::api::fal_request::FalRequest;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
pub struct Veo3p1FastTextToVideoInput {
|
||||
pub prompt: String,
|
||||
|
||||
/// Possible enum values: 9:16, 16:9, 1:1
|
||||
/// Default value "16:9"
|
||||
/// Options: "auto", "9:16", "16:9", "1:1"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub aspect_ratio: Option<String>,
|
||||
|
||||
/// Duration in seconds
|
||||
/// Possible enum values: 4s, 6s, 8s
|
||||
/// Default value 8s
|
||||
/// Options: "4s", "6s", "8s"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub duration: Option<String>,
|
||||
|
||||
/// Optional negative prompt
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub negative_prompt: Option<String>,
|
||||
|
||||
@@ -24,31 +23,25 @@ pub struct Veo3p1FastTextToVideoInput {
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub seed: Option<i64>,
|
||||
|
||||
/// Whether to automatically attempt to fix prompts that fail content policy or other validation checks by rewriting them
|
||||
/// Default value: true
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub auto_fix: Option<bool>,
|
||||
|
||||
/// Possible enum values: 720p, 1080p
|
||||
/// Default value 720p
|
||||
/// Options: "720p", "1080p"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub resolution: Option<String>,
|
||||
|
||||
/// Generate audio
|
||||
/// Default value "true"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub generate_audio: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct Veo3p1FastTextToVideoOutput {
|
||||
pub video: VideoFile,
|
||||
pub struct Veo3p1FastTextToVideoVideoFile {
|
||||
pub url: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
pub struct VideoFile {
|
||||
/// The URL where the file can be downloaded from.
|
||||
pub url: String,
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct Veo3p1FastTextToVideoOutput {
|
||||
pub video: Veo3p1FastTextToVideoVideoFile,
|
||||
}
|
||||
|
||||
pub fn veo_3p1_fast_text_to_video(
|
||||
+11
-18
@@ -1,20 +1,19 @@
|
||||
use crate::prelude::{Deserialize, FalRequest, Serialize};
|
||||
use crate::requests::api::fal_request::FalRequest;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
pub struct Veo3p1TextToVideoInput {
|
||||
pub prompt: String,
|
||||
|
||||
/// Possible enum values: 9:16, 16:9, 1:1
|
||||
/// Default value "16:9"
|
||||
/// Options: "auto", "9:16", "16:9", "1:1"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub aspect_ratio: Option<String>,
|
||||
|
||||
/// Duration in seconds
|
||||
/// Possible enum values: 4s, 6s, 8s
|
||||
/// Default value 8s
|
||||
/// Options: "4s", "6s", "8s"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub duration: Option<String>,
|
||||
|
||||
/// Optional negative prompt
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub negative_prompt: Option<String>,
|
||||
|
||||
@@ -24,31 +23,25 @@ pub struct Veo3p1TextToVideoInput {
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub seed: Option<i64>,
|
||||
|
||||
/// Whether to automatically attempt to fix prompts that fail content policy or other validation checks by rewriting them
|
||||
/// Default value: true
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub auto_fix: Option<bool>,
|
||||
|
||||
/// Possible enum values: 720p, 1080p
|
||||
/// Default value 720p
|
||||
/// Options: "720p", "1080p"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub resolution: Option<String>,
|
||||
|
||||
/// Generate audio
|
||||
/// Default value "true"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub generate_audio: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct Veo3p1TextToVideoOutput {
|
||||
pub video: VideoFile,
|
||||
pub struct Veo3p1TextToVideoVideoFile {
|
||||
pub url: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
pub struct VideoFile {
|
||||
/// The URL where the file can be downloaded from.
|
||||
pub url: String,
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct Veo3p1TextToVideoOutput {
|
||||
pub video: Veo3p1TextToVideoVideoFile,
|
||||
}
|
||||
|
||||
pub fn veo_3p1_text_to_video(
|
||||
@@ -0,0 +1,11 @@
|
||||
pub mod http_hailuo_v2p3_pro_text_to_video;
|
||||
pub mod http_kling_3p0_pro_text_to_video;
|
||||
pub mod http_kling_3p0_standard_text_to_video;
|
||||
pub mod http_kling_v2p5_turbo_pro_text_to_video;
|
||||
pub mod http_kling_v2p6_pro_text_to_video;
|
||||
pub mod http_pixverse_v5_text_to_video;
|
||||
pub mod http_seedance_1p5_pro_text_to_video;
|
||||
pub mod http_sora_2_pro_text_to_video;
|
||||
pub mod http_sora_2_text_to_video;
|
||||
pub mod http_veo_3p1_fast_text_to_video;
|
||||
pub mod http_veo_3p1_text_to_video;
|
||||
@@ -1,4 +1,4 @@
|
||||
pub mod api;
|
||||
pub mod http;
|
||||
pub mod queue;
|
||||
pub mod traits;
|
||||
pub mod webhook;
|
||||
@@ -1,69 +0,0 @@
|
||||
use crate::creds::fal_api_key::FalApiKey;
|
||||
use crate::error::classify_fal_error::classify_fal_error;
|
||||
use crate::error::fal_error_plus::FalErrorPlus;
|
||||
use crate::model::enqueued_request::EnqueuedRequest;
|
||||
use fal::endpoints::fal_ai::hunyuan3d::v2::v2;
|
||||
use fal::endpoints::fal_ai::hunyuan3d::v2::Hunyuan3DInput;
|
||||
use fal_client::file_to_base64_url::file_to_base64_url;
|
||||
use futures::StreamExt;
|
||||
use std::io::Write;
|
||||
use std::path::Path;
|
||||
|
||||
pub struct Hunyuan2Args<'a, P: AsRef<Path>> {
|
||||
pub image_path: P,
|
||||
pub api_key: &'a FalApiKey,
|
||||
}
|
||||
|
||||
pub async fn enqueue_hunyuan2_image_to_3d<P: AsRef<Path>>(args: Hunyuan2Args<'_, P>) -> Result<EnqueuedRequest, FalErrorPlus> {
|
||||
let image_url = file_to_base64_url(args.image_path)?;
|
||||
|
||||
let request = Hunyuan3DInput {
|
||||
input_image_url: image_url,
|
||||
textured_mesh: Some(true),
|
||||
guidance_scale: None,
|
||||
num_inference_steps: None,
|
||||
octree_resolution: None,
|
||||
seed: None,
|
||||
};
|
||||
|
||||
let result = v2(request)
|
||||
.with_api_key(&args.api_key.0)
|
||||
.queue()
|
||||
.await;
|
||||
|
||||
let result = match result {
|
||||
Ok(result) => result,
|
||||
Err(err) => return Err(classify_fal_error(err)),
|
||||
};
|
||||
|
||||
Ok(EnqueuedRequest::from_queue_response(&result)?)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::creds::fal_api_key::FalApiKey;
|
||||
use crate::requests::queue::enqueue_hunyuan2_image_to_3d::{enqueue_hunyuan2_image_to_3d, Hunyuan2Args};
|
||||
use errors::AnyhowResult;
|
||||
use std::fs::read_to_string;
|
||||
use test_utils::test_file_path::test_file_path;
|
||||
|
||||
#[tokio::test]
|
||||
#[ignore]
|
||||
async fn test() -> AnyhowResult<()> {
|
||||
let image = test_file_path("test_data/image/juno.jpg")?;
|
||||
|
||||
// XXX: Don't commit secrets!
|
||||
let secret = read_to_string("/Users/bt/Artcraft/credentials/fal_api_key.txt")?;
|
||||
|
||||
let api_key = FalApiKey::from_str(&secret);
|
||||
|
||||
let args = Hunyuan2Args {
|
||||
image_path: image,
|
||||
api_key: &api_key,
|
||||
};
|
||||
|
||||
let result = enqueue_hunyuan2_image_to_3d(args).await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
-69
@@ -1,69 +0,0 @@
|
||||
use crate::creds::fal_api_key::FalApiKey;
|
||||
use crate::error::classify_fal_error::classify_fal_error;
|
||||
use crate::error::fal_error_plus::FalErrorPlus;
|
||||
use crate::model::enqueued_request::EnqueuedRequest;
|
||||
use fal::endpoints::fal_ai::flux_pro::v1_1_ultra::v1_1_ultra;
|
||||
use fal::endpoints::fal_ai::flux_pro::v1_1_ultra::FluxProUltraTextToImageInput;
|
||||
use futures::StreamExt;
|
||||
use std::io::Write;
|
||||
|
||||
pub struct FluxPro11UltraTextToImageArgs<'a> {
|
||||
pub prompt: &'a str,
|
||||
pub api_key: &'a FalApiKey,
|
||||
// TODO: Size parameter
|
||||
}
|
||||
|
||||
pub async fn enqueue_flux_pro_11_ultra_text_to_image(args: FluxPro11UltraTextToImageArgs<'_>) -> Result<EnqueuedRequest, FalErrorPlus> {
|
||||
let request = FluxProUltraTextToImageInput {
|
||||
prompt: args.prompt.to_string(),
|
||||
// Maybe expose
|
||||
aspect_ratio: None, // Default is "16:9"
|
||||
num_images: Some(1), // Default is 1
|
||||
seed: None,
|
||||
raw: Some(true), // Generate less processed, more natural-looking images. Default is false.
|
||||
// Maybe abstract
|
||||
enable_safety_checker: Some(false),
|
||||
safety_tolerance: Some("5".to_string()), // 1 is most strict, 5 is most permissive
|
||||
// Constants
|
||||
output_format: Some("png".to_string()),
|
||||
sync_mode: None, // Synchronous / slow
|
||||
};
|
||||
|
||||
let result = v1_1_ultra(request)
|
||||
.with_api_key(&args.api_key.0)
|
||||
.queue()
|
||||
.await;
|
||||
|
||||
let result = match result {
|
||||
Ok(result) => result,
|
||||
Err(err) => return Err(classify_fal_error(err)),
|
||||
};
|
||||
|
||||
Ok(EnqueuedRequest::from_queue_response(&result)?)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::creds::fal_api_key::FalApiKey;
|
||||
use crate::requests::queue::image_gen::enqueue_flux_pro_11_ultra_text_to_image::{enqueue_flux_pro_11_ultra_text_to_image, FluxPro11UltraTextToImageArgs};
|
||||
use errors::AnyhowResult;
|
||||
use std::fs::read_to_string;
|
||||
|
||||
#[tokio::test]
|
||||
#[ignore]
|
||||
async fn test_flux_pro() -> AnyhowResult<()> {
|
||||
// XXX: Don't commit secrets!
|
||||
let secret = read_to_string("/Users/bt/Artcraft/credentials/fal_api_key.txt")?;
|
||||
|
||||
let api_key = FalApiKey::from_str(&secret);
|
||||
|
||||
let args = FluxPro11UltraTextToImageArgs {
|
||||
prompt: "a corgi smiles at the camera, inside retro video game store, lots of sci-fi props from Cowboy Bebop, photorealistic",
|
||||
api_key: &api_key,
|
||||
};
|
||||
|
||||
let result = enqueue_flux_pro_11_ultra_text_to_image(args).await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
-63
@@ -1,63 +0,0 @@
|
||||
use crate::creds::fal_api_key::FalApiKey;
|
||||
use crate::error::classify_fal_error::classify_fal_error;
|
||||
use crate::error::fal_error_plus::FalErrorPlus;
|
||||
use crate::model::enqueued_request::EnqueuedRequest;
|
||||
use fal::endpoints::fal_ai::recraft_v3::recraft_v3;
|
||||
use fal::endpoints::fal_ai::recraft_v3::ImageSizeProperty;
|
||||
use fal::endpoints::fal_ai::recraft_v3::TextToImageInput;
|
||||
use futures::StreamExt;
|
||||
use std::io::Write;
|
||||
|
||||
pub struct Recraft3TextToImageArgs<'a> {
|
||||
pub prompt: &'a str,
|
||||
pub api_key: &'a FalApiKey,
|
||||
// TODO: Size parameter
|
||||
}
|
||||
|
||||
pub async fn enqueue_recraft3_text_to_image(args: Recraft3TextToImageArgs<'_>) -> Result<EnqueuedRequest, FalErrorPlus> {
|
||||
let request = TextToImageInput {
|
||||
image_size: Some(ImageSizeProperty::SquareHd),
|
||||
prompt: args.prompt.to_string(),
|
||||
style: None, // eg. "realistic_image"
|
||||
style_id: None, // LoRA.
|
||||
colors: None, // Preferable colors. We can offer this later.
|
||||
};
|
||||
|
||||
let result = recraft_v3(request)
|
||||
.with_api_key(&args.api_key.0)
|
||||
.queue()
|
||||
.await;
|
||||
|
||||
let result = match result {
|
||||
Ok(result) => result,
|
||||
Err(err) => return Err(classify_fal_error(err)),
|
||||
};
|
||||
|
||||
Ok(EnqueuedRequest::from_queue_response(&result)?)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::creds::fal_api_key::FalApiKey;
|
||||
use crate::requests::queue::image_gen::enqueue_recraft3_text_to_image::{enqueue_recraft3_text_to_image, Recraft3TextToImageArgs};
|
||||
use errors::AnyhowResult;
|
||||
use std::fs::read_to_string;
|
||||
|
||||
#[tokio::test]
|
||||
#[ignore]
|
||||
async fn test_recraft3() -> AnyhowResult<()> {
|
||||
// XXX: Don't commit secrets!
|
||||
let secret = read_to_string("/Users/bt/Artcraft/credentials/fal_api_key.txt")?;
|
||||
|
||||
let api_key = FalApiKey::from_str(&secret);
|
||||
|
||||
let args = Recraft3TextToImageArgs {
|
||||
prompt: "a corgi looks out over the water",
|
||||
api_key: &api_key,
|
||||
};
|
||||
|
||||
let result = enqueue_recraft3_text_to_image(args).await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
pub mod enqueue_flux_pro_11_ultra_text_to_image;
|
||||
pub mod enqueue_recraft3_text_to_image;
|
||||
@@ -1,4 +0,0 @@
|
||||
pub mod enqueue_hunyuan2_image_to_3d;
|
||||
pub mod image_gen;
|
||||
pub mod remove_background_rembg;
|
||||
pub mod video_gen;
|
||||
@@ -1,75 +0,0 @@
|
||||
use crate::creds::fal_api_key::FalApiKey;
|
||||
use crate::error::classify_fal_error::classify_fal_error;
|
||||
use crate::error::fal_error_plus::FalErrorPlus;
|
||||
use fal::endpoints::fal_ai::imageutils::rembg::RemoveBackgroundInput;
|
||||
use fal::prelude::fal_ai::imageutils::rembg::rembg;
|
||||
use fal::prelude::*;
|
||||
use fal_client::file_to_base64_url::file_to_base64_url;
|
||||
use futures::StreamExt;
|
||||
use std::path::Path;
|
||||
use url::Url;
|
||||
|
||||
pub struct RemBgResponse {
|
||||
pub image_url: Url,
|
||||
}
|
||||
|
||||
/// remove background using `fal_ai/imageutils/rembg`
|
||||
pub async fn remove_background_rembg<P: AsRef<Path>>(image_path: P, api_key: &FalApiKey) -> Result<RemBgResponse, FalErrorPlus> {
|
||||
let image_url = file_to_base64_url(image_path)?;
|
||||
|
||||
let request = RemoveBackgroundInput {
|
||||
image_url,
|
||||
crop_to_bbox: None,
|
||||
sync_mode: None
|
||||
};
|
||||
|
||||
let result = rembg(request)
|
||||
.with_api_key(&api_key.0)
|
||||
.queue()
|
||||
.await;
|
||||
|
||||
let result = match result {
|
||||
Ok(result) => result,
|
||||
Err(err) => return Err(classify_fal_error(err)),
|
||||
};
|
||||
|
||||
let mut stream = result.stream(true).await?;
|
||||
|
||||
while let Some(status) = stream.next().await {
|
||||
let status = status?;
|
||||
if status.status == Status::Completed {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
let output = result.response().await?;
|
||||
|
||||
let url = Url::parse(&output.image.url)?;
|
||||
|
||||
Ok(RemBgResponse {
|
||||
image_url: url,
|
||||
})
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::creds::fal_api_key::FalApiKey;
|
||||
use crate::requests::queue::remove_background_rembg::remove_background_rembg;
|
||||
use errors::AnyhowResult;
|
||||
use std::fs::read_to_string;
|
||||
use test_utils::test_file_path::test_file_path;
|
||||
|
||||
#[tokio::test]
|
||||
#[ignore]
|
||||
async fn test_remove_background_rembg() -> AnyhowResult<()> {
|
||||
let image = test_file_path("test_data/image/juno.jpg")?;
|
||||
|
||||
// XXX: Don't commit secrets!
|
||||
let secret = read_to_string("/Users/bt/Artcraft/credentials/fal_api_key.txt")?;
|
||||
let api_key = FalApiKey::from_str(&secret);
|
||||
|
||||
let result = remove_background_rembg(image, &api_key).await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user