| Crates.io | diffusion_to |
| lib.rs | diffusion_to |
| version | 0.2.0 |
| created_at | 2023-09-29 23:45:48.01494+00 |
| updated_at | 2023-10-02 13:38:43.247702+00 |
| description | Rust crate for interacting with the diffusion.to API |
| homepage | https://github.com/w3irdrobot/diffusion_to |
| repository | https://github.com/w3irdrobot/diffusion_to |
| max_upload_size | |
| id | 988191 |
| size | 15,315 |
Rust crate for interacting with the diffusion.to API.
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)