add more parameters, so that the script can run in non interactive mode

This commit is contained in:
AdamBear 2022-08-18 16:54:21 +08:00
parent cd83f6fedf
commit 51eccfb5a3
5 changed files with 333 additions and 195 deletions

View file

@ -122,7 +122,7 @@ class FacesetEnhancerSubprocessor(Subprocessor):
return (0, filepath, None)
def process_folder ( dirpath, cpu_only=False, force_gpu_idxs=None ):
def process_folder ( dirpath, cpu_only=False, force_gpu_idxs=None, is_merge=None ):
device_config = nn.DeviceConfig.GPUIndexes( force_gpu_idxs or nn.ask_choose_device_idxs(suggest_all_gpu=True) ) \
if not cpu_only else nn.DeviceConfig.CPU()
@ -142,7 +142,9 @@ def process_folder ( dirpath, cpu_only=False, force_gpu_idxs=None ):
image_paths = [Path(x) for x in pathex.get_image_paths( dirpath )]
result = FacesetEnhancerSubprocessor ( image_paths, output_dirpath, device_config=device_config).run()
is_merge = io.input_bool (f"\r\nMerge {output_dirpath_parts} to {dirpath_parts} ?", True)
if is_merge is None:
is_merge = io.input_bool (f"\r\nMerge {output_dirpath_parts} to {dirpath_parts} ?", True)
if is_merge:
io.log_info (f"Copying processed files to {dirpath_parts}")