Struct stable_diffusion_api::Img2ImgRequest
source · pub struct Img2ImgRequest {Show 44 fields
pub init_images: Option<Vec<String>>,
pub resize_mode: Option<u32>,
pub denoising_strength: Option<f64>,
pub image_cfg_scale: Option<u32>,
pub mask: Option<String>,
pub mask_blur: Option<u32>,
pub inpainting_fill: Option<u32>,
pub inpaint_full_res: Option<bool>,
pub inpaint_full_res_padding: Option<u32>,
pub inpainting_mask_invert: Option<u32>,
pub initial_noise_multiplier: Option<u32>,
pub prompt: Option<String>,
pub styles: Option<Vec<String>>,
pub seed: Option<i64>,
pub subseed: Option<i64>,
pub subseed_strength: Option<u32>,
pub seed_resize_from_h: Option<i32>,
pub seed_resize_from_w: Option<i32>,
pub sampler_name: Option<String>,
pub batch_size: Option<u32>,
pub n_iter: Option<u32>,
pub steps: Option<u32>,
pub cfg_scale: Option<f64>,
pub width: Option<u32>,
pub height: Option<u32>,
pub restore_faces: Option<bool>,
pub tiling: Option<bool>,
pub do_not_save_samples: Option<bool>,
pub do_not_save_grid: Option<bool>,
pub negative_prompt: Option<String>,
pub eta: Option<u32>,
pub s_churn: Option<f64>,
pub s_tmax: Option<f64>,
pub s_tmin: Option<f64>,
pub s_noise: Option<f64>,
pub override_settings: Option<HashMap<String, Value>>,
pub override_settings_restore_afterwards: Option<bool>,
pub script_args: Option<Vec<Value>>,
pub sampler_index: Option<String>,
pub include_init_images: Option<bool>,
pub script_name: Option<String>,
pub send_images: Option<bool>,
pub save_images: Option<bool>,
pub alwayson_scripts: Option<HashMap<String, Value>>,
}
Expand description
Struct representing an image to image request.
Fields§
§init_images: Option<Vec<String>>
Initial images.
resize_mode: Option<u32>
Resize mode.
denoising_strength: Option<f64>
Strength of denoising applied to the image.
image_cfg_scale: Option<u32>
CFG scale.
mask: Option<String>
Mask.
mask_blur: Option<u32>
Blur to apply to the mask.
inpainting_fill: Option<u32>
Amount of inpainting to apply.
inpaint_full_res: Option<bool>
Whether to perform inpainting at full resolution.
inpaint_full_res_padding: Option<u32>
Padding to apply when performing inpainting at full resolution.
inpainting_mask_invert: Option<u32>
Whether to invert the inpainting mask.
initial_noise_multiplier: Option<u32>
Initial noise multiplier.
prompt: Option<String>
Text prompt for generating the image.
styles: Option<Vec<String>>
List of style prompts for generating the image.
seed: Option<i64>
Seed.
subseed: Option<i64>
Subseed.
subseed_strength: Option<u32>
Strength of the subseed.
seed_resize_from_h: Option<i32>
Height to resize the seed image from.
seed_resize_from_w: Option<i32>
Width to resize the seed image from.
sampler_name: Option<String>
Name of the sampler.
batch_size: Option<u32>
Batch size.
n_iter: Option<u32>
Number of iterations.
steps: Option<u32>
Number of steps.
cfg_scale: Option<f64>
CFG scale.
width: Option<u32>
Width of the generated image.
height: Option<u32>
Height of the generated image.
restore_faces: Option<bool>
Whether to restore faces in the generated image.
tiling: Option<bool>
Whether tiling for the generated image.
do_not_save_samples: Option<bool>
Whether to save samples when generating multiple images.
do_not_save_grid: Option<bool>
Whether to save the grid when generating multiple images.
negative_prompt: Option<String>
Negative prompt.
eta: Option<u32>
Eta value.
s_churn: Option<f64>
Churn value.
s_tmax: Option<f64>
Maximum temperature value.
s_tmin: Option<f64>
Minimum temperature value.
s_noise: Option<f64>
Amount of noise.
override_settings: Option<HashMap<String, Value>>
Settings to override when generating the image.
override_settings_restore_afterwards: Option<bool>
Whether to restore the settings after generating the image.
script_args: Option<Vec<Value>>
Arguments to pass to the script.
sampler_index: Option<String>
Index of the sampler.
include_init_images: Option<bool>
Whether to include initial images in the output.
script_name: Option<String>
Name of the script.
send_images: Option<bool>
Whether to send the generated images.
save_images: Option<bool>
Whether to save the generated images.
alwayson_scripts: Option<HashMap<String, Value>>
Scripts to always run.
Implementations§
source§impl Img2ImgRequest
impl Img2ImgRequest
sourcepub fn with_prompt(&mut self, prompt: String) -> &mut Self
pub fn with_prompt(&mut self, prompt: String) -> &mut Self
sourcepub fn with_image<T>(&mut self, image: T) -> &mut Self
pub fn with_image<T>(&mut self, image: T) -> &mut Self
sourcepub fn with_images<T>(&mut self, images: Vec<T>) -> &mut Self
pub fn with_images<T>(&mut self, images: Vec<T>) -> &mut Self
Adds multiple images to the request.
§Arguments
images
- A vector of byte arrays that represents the images to be added.
§Examples
use std::fs;
let mut req = Img2ImgRequest::default();
let image_data1 = fs::read("path/to/image1.jpg").unwrap();
let image_data2 = fs::read("path/to/image2.jpg").unwrap();
req.with_images(vec![image_data1, image_data2]);
sourcepub fn with_styles(&mut self, styles: Vec<String>) -> &mut Self
pub fn with_styles(&mut self, styles: Vec<String>) -> &mut Self
sourcepub fn with_style(&mut self, style: String) -> &mut Self
pub fn with_style(&mut self, style: String) -> &mut Self
sourcepub fn with_denoising_strength(&mut self, denoising_strength: f64) -> &mut Self
pub fn with_denoising_strength(&mut self, denoising_strength: f64) -> &mut Self
sourcepub fn with_subseed(&mut self, subseed: i64) -> &mut Self
pub fn with_subseed(&mut self, subseed: i64) -> &mut Self
sourcepub fn with_subseed_strength(&mut self, subseed_strength: u32) -> &mut Self
pub fn with_subseed_strength(&mut self, subseed_strength: u32) -> &mut Self
sourcepub fn with_sampler_name(&mut self, sampler_name: String) -> &mut Self
pub fn with_sampler_name(&mut self, sampler_name: String) -> &mut Self
sourcepub fn with_batch_size(&mut self, batch_size: u32) -> &mut Self
pub fn with_batch_size(&mut self, batch_size: u32) -> &mut Self
sourcepub fn with_n_iter(&mut self, n_iter: u32) -> &mut Self
pub fn with_n_iter(&mut self, n_iter: u32) -> &mut Self
sourcepub fn with_steps(&mut self, steps: u32) -> &mut Self
pub fn with_steps(&mut self, steps: u32) -> &mut Self
sourcepub fn with_cfg_scale(&mut self, cfg_scale: f64) -> &mut Self
pub fn with_cfg_scale(&mut self, cfg_scale: f64) -> &mut Self
sourcepub fn with_width(&mut self, width: u32) -> &mut Self
pub fn with_width(&mut self, width: u32) -> &mut Self
sourcepub fn with_height(&mut self, height: u32) -> &mut Self
pub fn with_height(&mut self, height: u32) -> &mut Self
sourcepub fn with_restore_faces(&mut self, restore_faces: bool) -> &mut Self
pub fn with_restore_faces(&mut self, restore_faces: bool) -> &mut Self
sourcepub fn with_tiling(&mut self, tiling: bool) -> &mut Self
pub fn with_tiling(&mut self, tiling: bool) -> &mut Self
sourcepub fn with_negative_prompt(&mut self, negative_prompt: String) -> &mut Self
pub fn with_negative_prompt(&mut self, negative_prompt: String) -> &mut Self
Trait Implementations§
source§impl Clone for Img2ImgRequest
impl Clone for Img2ImgRequest
source§fn clone(&self) -> Img2ImgRequest
fn clone(&self) -> Img2ImgRequest
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for Img2ImgRequest
impl Debug for Img2ImgRequest
source§impl Default for Img2ImgRequest
impl Default for Img2ImgRequest
source§fn default() -> Img2ImgRequest
fn default() -> Img2ImgRequest
source§impl<'de> Deserialize<'de> for Img2ImgRequest
impl<'de> Deserialize<'de> for Img2ImgRequest
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl PartialEq for Img2ImgRequest
impl PartialEq for Img2ImgRequest
source§fn eq(&self, other: &Img2ImgRequest) -> bool
fn eq(&self, other: &Img2ImgRequest) -> bool
self
and other
values to be equal, and is used
by ==
.