mirror of
https://github.com/storytold/storyteller-ml.git
synced 2026-10-09 00:09:55 +00:00
Add IPA arguments
This commit is contained in:
@@ -95,6 +95,7 @@ def parse_args():
|
||||
parser = argparse.ArgumentParser(description='Run Comfy')
|
||||
parser.add_argument('--prompt', type=str, help='location of the prompt json', required=False)
|
||||
parser.add_argument('--style', type=str, help='style name', required=False)
|
||||
parser.add_argument('--global_ipa_image_filename', type=str, help='Global IPA image (optional)', required=False)
|
||||
parser.add_argument('--positive_prompt_filename', type=str, help='positive prompt', required=False)
|
||||
parser.add_argument('--negative_prompt_filename', type=str, help='negative prompt', required=False)
|
||||
parser.add_argument('--pause-between-steps', type=int, help='pause between steps', required=False, default=1)
|
||||
@@ -167,7 +168,8 @@ def main():
|
||||
prompt = generate_prompt_for_style(style, positive_prompt, negative_prompt, workflow_filename,
|
||||
denoise_first_pass=denoise_first_pass,
|
||||
enable_lipsync=enable_lipsync,
|
||||
disable_lcm=disable_lcm)
|
||||
disable_lcm=disable_lcm
|
||||
global_ipa_image_filename=args.global_ipa_image_filename)
|
||||
enqueue_prompt_and_wait(prompt)
|
||||
output_index = output_index + 1
|
||||
left = Path(COMFY_ROOT_DIRECTORY) / "output" / f"vid2vid/SparseUpscaleInterp_0000{output_index}.mp4"
|
||||
@@ -178,7 +180,8 @@ def main():
|
||||
workflow_filename = UPSCALER_WORKFLOW
|
||||
prompt = generate_prompt_for_style(style, positive_prompt, negative_prompt, workflow_filename, PipelineType.UPSCALER,
|
||||
denoise_first_pass=denoise_first_pass,
|
||||
enable_lipsync=enable_lipsync)
|
||||
enable_lipsync=enable_lipsync,
|
||||
global_ipa_image_filename=args.global_ipa_image_filename)
|
||||
enqueue_prompt_and_wait(prompt)
|
||||
output_index = output_index + 1
|
||||
left = Path(COMFY_ROOT_DIRECTORY) / "output" / f"vid2vid/SparseUpscaleInterp_0000{output_index}.mp4"
|
||||
@@ -188,7 +191,8 @@ def main():
|
||||
workflow_filename = FACE_DETAILER_WORKFLOW
|
||||
prompt = generate_prompt_for_style(style, positive_prompt, negative_prompt, workflow_filename, PipelineType.FACE_DETAILER,
|
||||
denoise_first_pass=denoise_first_pass,
|
||||
enable_lipsync=enable_lipsync)
|
||||
enable_lipsync=enable_lipsync,
|
||||
global_ipa_image_filename=args.global_ipa_image_filename)
|
||||
enqueue_prompt_and_wait(prompt)
|
||||
output_index = output_index + 1
|
||||
left = Path(COMFY_ROOT_DIRECTORY) / "output" / f"vid2vid/SparseUpscaleInterp_0000{output_index}.mp4"
|
||||
@@ -240,7 +244,8 @@ def enqueue_prompt_and_wait(prompt):
|
||||
def generate_prompt_for_style(style_name, positive_prompt, negative_prompt, workflow_filename=None, pipeline_type = PipelineType.BASE,
|
||||
denoise_first_pass=1.0,
|
||||
enable_lipsync: bool = False,
|
||||
disable_lcm: bool = False) -> Path:
|
||||
disable_lcm: bool = False,
|
||||
global_ipa_image_filename: Optional[str] = None) -> Path:
|
||||
styles_directory = Path(V2V_WORKFLOWS_DIRECTORY) / "styles"
|
||||
workflow_directory = Path(V2V_WORKFLOWS_DIRECTORY) / "workflows"
|
||||
mappings_directory = Path(V2V_WORKFLOWS_DIRECTORY) / "mappings"
|
||||
@@ -261,7 +266,8 @@ def generate_prompt_for_style(style_name, positive_prompt, negative_prompt, work
|
||||
jsonpath_mods = get_jsonpath_mods(json_mods, mapping_json, pos_in=positive_prompt, neg_in=negative_prompt, pipeline_type=pipeline_type,
|
||||
denoise_first_pass=denoise_first_pass,
|
||||
enable_lipsync=enable_lipsync,
|
||||
disable_lcm=disable_lcm)
|
||||
disable_lcm=disable_lcm,
|
||||
global_ipa_image_filename=global_ipa_image_filename)
|
||||
|
||||
print(*jsonpath_mods.items(), sep="\n")
|
||||
|
||||
@@ -274,7 +280,8 @@ def generate_prompt_for_style(style_name, positive_prompt, negative_prompt, work
|
||||
def get_jsonpath_mods(style_mods: Dict[str, Any], mapping_json: Dict[str, Any], pos_in: Optional[str] = None,
|
||||
neg_in: Optional[str] = None, pipeline_type = PipelineType.BASE, denoise_first_pass=1.0,
|
||||
enable_lipsync: bool = False,
|
||||
disable_lcm: bool = False) -> Dict[str, Any]:
|
||||
disable_lcm: bool = False,
|
||||
global_ipa_image_filename: Optional[str] = None) -> Dict[str, Any]:
|
||||
modifications = {}
|
||||
new_mod_json = style_mods.copy()
|
||||
# Process "loras" differently
|
||||
@@ -324,6 +331,11 @@ def get_jsonpath_mods(style_mods: Dict[str, Any], mapping_json: Dict[str, Any],
|
||||
modifications["$.536.inputs.boolean_number"] = 0
|
||||
|
||||
|
||||
# TODO(bt,2024-06-22): Move this to the mappings so we don't have to maintain the jsonpath
|
||||
if global_ipa_image_filename:
|
||||
modifications["$.3723.inputs.image_path"] = global_ipa_image_filename
|
||||
modifications["$.900.inputs.value"] = 1.0 # TODO: Make this a slider in the UI
|
||||
|
||||
return modifications
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user