diffusion_to

Crates.iodiffusion_to
lib.rsdiffusion_to
version0.2.0
sourcesrc
created_at2023-09-29 23:45:48.01494
updated_at2023-10-02 13:38:43.247702
descriptionRust crate for interacting with the diffusion.to API
homepagehttps://github.com/w3irdrobot/diffusion_to
repositoryhttps://github.com/w3irdrobot/diffusion_to
max_upload_size
id988191
size15,315
(w3irdrobot)

documentation

README

diffusion_to

Rust crate for interacting with the diffusion.to API.

Using the crate

First, add the crate to the project.

cargo add diffusion_to

Instantiate a client, create an image request, and send it off. Wait for the image to be created and download it.

let client = DiffusionClient::new(args.api_key)?;

let request = ImageRequest::new(args.prompt)
    .update_steps(args.steps.try_into()?)
    .update_model(args.model.try_into()?)
let token = client.request_image(request).await?;

// wait for up to five minutes
let image = client
    .check_and_wait(token, Some(Duration::from_secs(300)))
    .await?;

println!("{}", image.raw)
Commit count: 8

cargo fmt