I was working on my own leejet/stable-diffusion.cpp rust bindings but then I found yours.
You did a great job with the PresetBuilder and Presets for configuration!
But. It took me a while to find the .with_modifier(f) method, and even now I'm not sure I'm using it the intended way.
use diffusion_rs::{
api::gen_img,
preset::{Flux2Weight, Preset, PresetBuilder},
util::set_hf_token,
};
fn main() {
set_hf_token(std::env::var("MY_HF_API_TOKEN").unwrap());
let (config, mut model_config) = PresetBuilder::default()
.preset(Preset::Flux2Dev(Flux2Weight::Q4_0))
.with_modifier(|(mut c, m)| {
c.width(1024).height(1024).output("dumdum.png").seed(-1);
Ok((c, m))
})
.prompt("donkey eating a lemon")
.build()
.unwrap();
gen_img(&config, &mut model_config).unwrap();
}
Is above the intended usage? And if so, may I suggest adding it to the example in the README?
I was working on my own leejet/stable-diffusion.cpp rust bindings but then I found yours.
You did a great job with the
PresetBuilderandPresetsfor configuration!But. It took me a while to find the
.with_modifier(f)method, and even now I'm not sure I'm using it the intended way.Is above the intended usage? And if so, may I suggest adding it to the example in the README?