Expand description
§diffusion_to
diffusion_to
is a library for interacting with the API for diffusion.to.
This API makes it easy to create AI-generated images and download them in a base64 format to be used
however is needed. All options available in the UI are available through the library, using enums where
possible to prevent invalid requests from being made.
§Example
Basic usage:
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!("{}", iamge.raw)
Modules§
Structs§
- Diffusion
Client - The client used to interact with the diffusion.to API
- Diffusion
Image - The image response returned from the API when the image is complete
- Image
Request - An image request to notify the API of the parameters of the image to create
- Image
Token - A token returned from the API that is used to check the status of the image and get the image when completed
Enums§
- Diffusion
Error - Potential errors returned from the library
- Image
Model - The available image models provided through the API
- Image
Orientation - The available iamge orientations provided through the API
- Image
Size - The available image sizes provided through the API
- Image
Steps - The available steps provided through the API