fal/endpoints/fal_ai/gemini_flash_edit/
mod.rs

1#[allow(unused_imports)]
2use crate::prelude::*;
3#[allow(unused_imports)]
4use serde::{Deserialize, Serialize};
5#[allow(unused_imports)]
6use std::collections::HashMap;
7
8#[cfg(any(
9    feature = "endpoints",
10    feature = "endpoints_fal-ai",
11    feature = "endpoints_fal-ai_gemini-flash-edit"
12))]
13#[cfg_attr(
14    docsrs,
15    doc(cfg(any(
16        feature = "endpoints",
17        feature = "endpoints_fal-ai",
18        feature = "endpoints_fal-ai_gemini-flash-edit"
19    )))
20)]
21pub mod multi;
22
23#[derive(Debug, Serialize, Deserialize)]
24pub struct GeminiImageOutput {
25    /// Text description or response from Gemini
26    pub description: String,
27    /// The generated or edited image
28    pub image: Image,
29}
30
31#[derive(Debug, Serialize, Deserialize, Default)]
32pub struct GeminiImageRequest {
33    /// Optional URL of an input image for editing. If not provided, generates a new image.
34    /// "https://storage.googleapis.com/falserverless/web-examples/gemini-edit/input.png"
35    pub image_url: String,
36    /// The prompt for image generation or editing
37    /// "Make the car black"
38    pub prompt: String,
39}
40
41#[derive(Debug, Serialize, Deserialize, Default)]
42pub struct GeminiMultiImageRequest {
43    /// List of URLs of input images for editing
44    /// ["https://storage.googleapis.com/falserverless/web-examples/gemini-edit/input.png"]
45    pub input_image_urls: Vec<String>,
46    /// The prompt for image generation or editing
47    /// "Make the car black"
48    pub prompt: String,
49}
50
51#[derive(Debug, Serialize, Deserialize, Default)]
52pub struct HTTPValidationError {
53    #[serde(skip_serializing_if = "Option::is_none")]
54    pub detail: Option<Vec<Option<ValidationError>>>,
55}
56
57#[derive(Debug, Serialize, Deserialize, Default)]
58pub struct Image {
59    /// The mime type of the file.
60    /// "image/png"
61    #[serde(skip_serializing_if = "Option::is_none")]
62    pub content_type: Option<ContentTypeProperty>,
63    /// The name of the file. It will be auto-generated if not provided.
64    /// "z9RV14K95DvU.png"
65    #[serde(skip_serializing_if = "Option::is_none")]
66    pub file_name: Option<FileNameProperty>,
67    /// The size of the file in bytes.
68    /// 4404019
69    #[serde(skip_serializing_if = "Option::is_none")]
70    pub file_size: Option<FileSizeProperty>,
71    /// The height of the image in pixels.
72    /// 1024
73    #[serde(skip_serializing_if = "Option::is_none")]
74    pub height: Option<HeightProperty>,
75    /// The URL where the file can be downloaded from.
76    pub url: String,
77    /// The width of the image in pixels.
78    /// 1024
79    #[serde(skip_serializing_if = "Option::is_none")]
80    pub width: Option<WidthProperty>,
81}
82
83#[derive(Debug, Serialize, Deserialize, Default)]
84pub struct ValidationError {
85    pub loc: Vec<serde_json::Value>,
86    pub msg: String,
87    #[serde(rename = "type")]
88    pub ty: String,
89}
90
91#[derive(Debug, Serialize, Deserialize, smart_default::SmartDefault)]
92#[allow(non_camel_case_types)]
93pub enum ContentTypeProperty {
94    #[default]
95    String(String),
96    Null(serde_json::Value),
97}
98
99#[derive(Debug, Serialize, Deserialize, smart_default::SmartDefault)]
100#[allow(non_camel_case_types)]
101pub enum FileNameProperty {
102    #[default]
103    String(String),
104    Null(serde_json::Value),
105}
106
107#[derive(Debug, Serialize, Deserialize, smart_default::SmartDefault)]
108#[allow(non_camel_case_types)]
109pub enum FileSizeProperty {
110    #[default]
111    Integer(i64),
112    Null(serde_json::Value),
113}
114
115#[derive(Debug, Serialize, Deserialize, smart_default::SmartDefault)]
116#[allow(non_camel_case_types)]
117pub enum HeightProperty {
118    #[default]
119    Integer(i64),
120    Null(serde_json::Value),
121}
122
123#[derive(Debug, Serialize, Deserialize, smart_default::SmartDefault)]
124#[allow(non_camel_case_types)]
125pub enum WidthProperty {
126    #[default]
127    Integer(i64),
128    Null(serde_json::Value),
129}
130
131/// Gemini Flash Edit
132///
133/// Category: image-to-image
134///
135///
136///
137/// Generate or edit an image using Gemini
138pub fn gemini_flash_edit(
139    params: GeminiImageRequest,
140) -> FalRequest<GeminiImageRequest, GeminiImageOutput> {
141    FalRequest::new("fal-ai/gemini-flash-edit", params)
142}