fix: noise seed

This commit is contained in:
nick 2024-08-20 19:36:29 -07:00
parent 894d8e1503
commit dfee31f0ed

View File

@ -234,29 +234,32 @@ def apply_random_seed_to_workflow(workflow_api):
workflow_api (dict): The workflow API dictionary to modify. workflow_api (dict): The workflow API dictionary to modify.
""" """
for key in workflow_api: for key in workflow_api:
if 'inputs' in workflow_api[key] and 'seed' in workflow_api[key]['inputs']: if 'inputs' in workflow_api[key]
if isinstance(workflow_api[key]['inputs']['seed'], list): if 'seed' in workflow_api[key]['inputs']:
continue if isinstance(workflow_api[key]['inputs']['seed'], list):
if workflow_api[key]['class_type'] == "PromptExpansion": continue
workflow_api[key]['inputs']['seed'] = randomSeed(8) if workflow_api[key]['class_type'] == "PromptExpansion":
logger.info(f"Applied random seed {workflow_api[key]['inputs']['seed']} to PromptExpansion") workflow_api[key]['inputs']['seed'] = randomSeed(8)
continue logger.info(f"Applied random seed {workflow_api[key]['inputs']['seed']} to PromptExpansion")
if workflow_api[key]['class_type'] == "RandomNoise": continue
workflow_api[key]['inputs']['noise_seed'] = randomSeed() workflow_api[key]['inputs']['seed'] = randomSeed()
logger.info(f"Applied random noise_seed {workflow_api[key]['inputs']['noise_seed']} to RandomNoise") logger.info(f"Applied random seed {workflow_api[key]['inputs']['seed']} to {workflow_api[key]['class_type']}")
continue
if workflow_api[key]['class_type'] == "KSamplerAdvanced":
workflow_api[key]['inputs']['noise_seed'] = randomSeed()
logger.info(f"Applied random noise_seed {workflow_api[key]['inputs']['noise_seed']} to KSamplerAdvanced")
continue
if workflow_api[key]['class_type'] == "SamplerCustom":
workflow_api[key]['inputs']['noise_seed'] = randomSeed()
logger.info(f"Applied random noise_seed {workflow_api[key]['inputs']['noise_seed']} to SamplerCustom")
continue
workflow_api[key]['inputs']['seed'] = randomSeed()
logger.info(f"Applied random seed {workflow_api[key]['inputs']['seed']} to {workflow_api[key]['class_type']}")
def apply_inputs_to_workflow(workflow_api: Any, inputs: Any, sid: str = None): if 'noise_seed' in workflow_api[key]:
if workflow_api[key]['class_type'] == "RandomNoise":
workflow_api[key]['inputs']['noise_seed'] = randomSeed()
logger.info(f"Applied random noise_seed {workflow_api[key]['inputs']['noise_seed']} to RandomNoise")
continue
if workflow_api[key]['class_type'] == "KSamplerAdvanced":
workflow_api[key]['inputs']['noise_seed'] = randomSeed()
logger.info(f"Applied random noise_seed {workflow_api[key]['inputs']['noise_seed']} to KSamplerAdvanced")
continue
if workflow_api[key]['class_type'] == "SamplerCustom":
workflow_api[key]['inputs']['noise_seed'] = randomSeed()
logger.info(f"Applied random noise_seed {workflow_api[key]['inputs']['noise_seed']} to SamplerCustom")
continue
def apply_inputs_to_workflow(workflow_api: Any, inputs: Any, sid: str | None = None):
# Loop through each of the inputs and replace them # Loop through each of the inputs and replace them
for key, value in workflow_api.items(): for key, value in workflow_api.items():
if 'inputs' in value: if 'inputs' in value: