1 unstable release

0.1.0 Mar 9, 2025

#21 in #generative-ai

Download history 137/week @ 2025-03-06 33/week @ 2025-03-13 7/week @ 2025-03-20

177 downloads per month
Used in fal

MIT/Apache

7KB
109 lines

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);
}

Dependencies

~215–650KB
~16K SLoC