fal-derive

Crates.iofal-derive
lib.rsfal-derive
version0.1.0
created_at2025-03-09 07:08:51.525655+00
updated_at2025-03-09 07:08:51.525655+00
descriptionMacros for creating fal API endpoint functions
homepage
repositoryhttps://github.com/carlosdp/fal-rs
max_upload_size
id1585220
size7,300
Carlos Diaz-Padron (carlosdp)

documentation

README

Creates a custom endpoint function, compatible with the fal API.

use fal::prelude::*;
use serde::Deserialize;

#[derive(Deserialize)]
pub struct FalResponse {
  pub images: Vec<File>,
}

#[endpoint(endpoint="fal-ai/flux/dev")]
pub fn flux_dev(prompt: String) -> FalResponse {}

// This endpoint function can now be used to call the fal endpoint:
#[tokio::main]
async fn main() {
    let response = flux_dev("an horse riding an astronaut".to_owned())
    .send()
    .await
    .unwrap();

    println!("Generated image URL: {}", response.images[0].url);
}
Commit count: 73

cargo fmt