mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-14 22:02:36 +00:00
fal.rs nanobanana wrappers
This commit is contained in:
1 parent
736ac055cc
commit
bbb62bb1a8
2 files changed
+20
-52
No files matched your search
+7
-23
@@ -33,37 +33,21 @@ pub struct NanoBananaProImageEditInput {
|
||||
],
|
||||
"resolution": "1K"
|
||||
}
|
||||
*/
|
||||
*/
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
pub struct File {
|
||||
pub struct ImageFile {
|
||||
/// The URL where the file can be downloaded from.
|
||||
pub url: String,
|
||||
|
||||
// /// The mime type of the file.
|
||||
// /// "image/png"
|
||||
// #[serde(skip_serializing_if = "Option::is_none")]
|
||||
// pub content_type: Option<String>,
|
||||
// /// File data
|
||||
// #[serde(skip_serializing_if = "Option::is_none")]
|
||||
// pub file_data: Option<String>,
|
||||
// /// The name of the file. It will be auto-generated if not provided.
|
||||
// /// "z9RV14K95DvU.png"
|
||||
// #[serde(skip_serializing_if = "Option::is_none")]
|
||||
// pub file_name: Option<String>,
|
||||
// /// The size of the file in bytes.
|
||||
// /// 4404019
|
||||
// #[serde(skip_serializing_if = "Option::is_none")]
|
||||
// pub file_size: Option<i64>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct Gemini25FlashImageEditOutput {
|
||||
pub images: Vec<File>,
|
||||
pub struct NanoBananaProImageEditOutput {
|
||||
pub images: Vec<ImageFile>,
|
||||
}
|
||||
|
||||
pub fn gemini_25_flash_image_edit(
|
||||
params: Gemini25FlashImageEditInput,
|
||||
) -> FalRequest<Gemini25FlashImageEditInput, Gemini25FlashImageEditOutput> {
|
||||
FalRequest::new("fal-ai/gemini-25-flash-image/edit", params)
|
||||
params: NanoBananaProImageEditInput,
|
||||
) -> FalRequest<NanoBananaProImageEditInput, NanoBananaProImageEditOutput> {
|
||||
FalRequest::new("fal-ai/nano-banana-pro/edit", params)
|
||||
}
|
||||
+13
-29
@@ -1,53 +1,37 @@
|
||||
use crate::prelude::{Deserialize, FalRequest, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
pub struct Gemini25FlashImageEditInput {
|
||||
pub struct NanoBananaProTextToImageInput {
|
||||
pub prompt: String,
|
||||
|
||||
pub image_urls: Vec<String>,
|
||||
/// Eg. "16:9", "1:1", and a ton of other options. So many options.
|
||||
pub aspect_ratio: String,
|
||||
|
||||
/// Eg. "1K", "2K", "4K"
|
||||
pub resolution: String,
|
||||
|
||||
/// 1 - 4
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub num_images: Option<u8>,
|
||||
|
||||
/// "jpeg" or "png"
|
||||
/// "jpeg", "png", "webp"
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub output_format: Option<String>,
|
||||
|
||||
// /// Resolution, eg. "720p"
|
||||
// #[serde(skip_serializing_if = "Option::is_none")]
|
||||
// pub resolution: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||
pub struct File {
|
||||
pub struct ImageFile {
|
||||
/// The URL where the file can be downloaded from.
|
||||
pub url: String,
|
||||
|
||||
// /// The mime type of the file.
|
||||
// /// "image/png"
|
||||
// #[serde(skip_serializing_if = "Option::is_none")]
|
||||
// pub content_type: Option<String>,
|
||||
// /// File data
|
||||
// #[serde(skip_serializing_if = "Option::is_none")]
|
||||
// pub file_data: Option<String>,
|
||||
// /// The name of the file. It will be auto-generated if not provided.
|
||||
// /// "z9RV14K95DvU.png"
|
||||
// #[serde(skip_serializing_if = "Option::is_none")]
|
||||
// pub file_name: Option<String>,
|
||||
// /// The size of the file in bytes.
|
||||
// /// 4404019
|
||||
// #[serde(skip_serializing_if = "Option::is_none")]
|
||||
// pub file_size: Option<i64>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct Gemini25FlashImageEditOutput {
|
||||
pub images: Vec<File>,
|
||||
pub struct NanoBananaProTextToImageOutput {
|
||||
pub images: Vec<ImageFile>,
|
||||
}
|
||||
|
||||
pub fn gemini_25_flash_image_edit(
|
||||
params: Gemini25FlashImageEditInput,
|
||||
) -> FalRequest<Gemini25FlashImageEditInput, Gemini25FlashImageEditOutput> {
|
||||
FalRequest::new("fal-ai/gemini-25-flash-image/edit", params)
|
||||
params: NanoBananaProTextToImageInput,
|
||||
) -> FalRequest<NanoBananaProTextToImageInput, NanoBananaProTextToImageOutput> {
|
||||
FalRequest::new("fal-ai/nano-banana-pro", params)
|
||||
}
|
||||
Reference in new issue
Block a user