def init_checkpoints_sub_parser(subparsers): checkpoints_parser = subparsers.add_parser( 'checkpoints', description="Handle checkpoints for dreampower.", help="Handle checkpoints for dreampower.", add_help=False) # add checkpoints arguments arg_checkpoints(checkpoints_parser) arg_help(checkpoints_parser) arg_debug(checkpoints_parser) arg_version(checkpoints_parser) # add download subparser checkpoints_parser_subparser = checkpoints_parser.add_subparsers() checkpoints_parser_info_parser = checkpoints_parser_subparser.add_parser( 'download', description="Download checkpoints for dreampower.", help="Download checkpoints for dreampower.") checkpoints_parser.set_defaults(func=checkpoints.main) checkpoints_parser_info_parser.set_defaults(func=checkpoints.download) return checkpoints_parser
def init_run_parser(subparsers): run_parser = subparsers.add_parser( 'run', description="Process image(s) with dreampower.", help="Process image(s) with dreampower.", add_help=False) run_parser.set_defaults(func=main.main) # conflicts handler processing_mod = run_parser.add_mutually_exclusive_group() scale_mod = run_parser.add_mutually_exclusive_group() # add run arguments arg_input(run_parser) arg_output(run_parser) arg_auto_rescale(scale_mod) arg_auto_resize(scale_mod) arg_auto_resize_crop(scale_mod) arg_overlay(scale_mod) arg_ignore_size(scale_mod) arg_color_transfer(run_parser) arg_artifacts_inpaint(run_parser) arg_compress(run_parser) arg_image_size(run_parser) arg_preferences(run_parser) arg_n_run(run_parser) arg_step(run_parser) arg_altered(run_parser) arg_cpu(processing_mod) arg_gpu(processing_mod) arg_checkpoints(run_parser) arg_n_core(run_parser) arg_gan_persistent(run_parser) arg_json_args(run_parser) arg_json_folder_name(run_parser) arg_output_masks(run_parser) arg_help(run_parser) arg_debug(run_parser) arg_version(run_parser)
def init_gpu_info_sub_parser(subparsers): gpu_info_parser = subparsers.add_parser( 'gpu-info', description= "Getting GPU capabilities information for processing with dreampower", help= "Getting GPU capabilities information for processing with dreampower", add_help=False) gpu_info_parser.set_defaults(func=gpu_info.main) # add gpu-info arguments arg_json(gpu_info_parser) arg_help(gpu_info_parser) arg_debug(gpu_info_parser) arg_version(gpu_info_parser) return gpu_info_parser
def init_parser(): parser = argparse.ArgumentParser( description= "Dreampower CLI application that allow to transform photos of people for private entertainment", add_help=False) # add args main arg_help(parser) arg_debug(parser) arg_version(parser) # add subparsers subparsers = parser.add_subparsers(dest="mode") init_run_parser(subparsers) init_checkpoints_sub_parser(subparsers) init_gpu_info_sub_parser(subparsers) init_daemon_sub_parser(subparsers) return parser
def init_daemon_sub_parser(subparsers): daemon_parser = subparsers.add_parser( 'daemon', description="Running dreampower on daemon mode.", help="Running dreampower on daemon mode.", add_help=False ) daemon_parser.set_defaults(func=daemon.main) # conflicts handler processing_mod = daemon_parser.add_mutually_exclusive_group() scale_mod = daemon_parser.add_mutually_exclusive_group() # add daemon arguments arg_input(daemon_parser) arg_output(daemon_parser) arg_auto_rescale(scale_mod) arg_auto_resize(scale_mod) arg_auto_resize_crop(scale_mod) arg_ignore_size(daemon_parser) arg_color_transfer(daemon_parser) arg_compress(daemon_parser) arg_image_size(daemon_parser) arg_preferences(daemon_parser) arg_cpu(processing_mod) arg_gpu(processing_mod) arg_checkpoints(daemon_parser) arg_n_core(daemon_parser) arg_json_args(daemon_parser) arg_json_folder_name(daemon_parser) arg_help(daemon_parser) arg_debug(daemon_parser) arg_version(daemon_parser) return daemon_parser