pass ipa file and strength to comfy

This commit is contained in:
Brandon Thomas committed 2024-06-22 19:34:47 -04:00
1 parent d81bd219a2
commit e0180712f7
2 files changed
+21

No files matched your search

@@ -96,6 +96,9 @@ pub struct InferenceArgs<'s> {
pub use_cinematic: bool,
pub maybe_strength: Option<f32>,
pub global_ipa_image_filename: Option<String>,
pub global_ipa_strength: Option<f32>,
}
#[derive(Debug)]
@@ -293,6 +296,20 @@ impl ComfyInferenceCommand {
command.push_str(" ");
}
if let Some(global_ipa_image_filename) = &args.global_ipa_image_filename {
// NB: This is very dangerous. We're not handling escaping well.
command.push_str(" --global_ipa_image_filename ");
command.push_str(&format!("'{}'", global_ipa_image_filename));
command.push_str(" ");
}
if let Some(global_ipa_strength) = &args.global_ipa_strength {
command.push_str(" --global_ipa_strength ");
command.push_str(&format!("{}", global_ipa_strength));
command.push_str(" ");
}
if let Some(docker_options) = self.maybe_docker_options.as_ref() {
command = docker_options.to_command_string(&command);
}
@@ -322,6 +322,10 @@ pub async fn process_job(args: ComfyProcessJobArgs<'_>) -> Result<JobSuccessResu
disable_lcm: comfy_args.disable_lcm.unwrap_or(false),
use_cinematic: comfy_args.use_cinematic.unwrap_or(false),
maybe_strength: comfy_args.strength,
global_ipa_image_filename: global_ipa_image
.as_ref()
.map(|image| path_to_string(&image.ipa_image_path)),
global_ipa_strength: None, // TODO: Expose a UI slider
});
let inference_duration = Instant::now().duration_since(inference_start_time);