def cli(input, batch_input, suffix, verbose, format_type, pdf_format, serializer, device, raise_on_error): """ Base command for recognition functionality. Inputs are defined as one or more pairs `-i input_file output_file` followed by one or more chainable processing commands. Likewise, verbosity is set on all subcommands with the `-v` switch. """ ctx = click.get_current_context() if device != 'cpu': import torch try: torch.ones(1, device=device) except AssertionError as e: if raise_on_error: raise logger.error(f'Device {device} not available: {e.args[0]}.') ctx.exit(1) ctx.meta['device'] = device ctx.meta[ 'input_format_type'] = format_type if format_type != 'pdf' else 'image' ctx.meta['raise_failed'] = raise_on_error ctx.meta['output_mode'] = serializer ctx.meta['verbose'] = verbose log.set_logger(logger, level=30 - min(10 * verbose, 20))
def cli(verbose, seed): if seed: import numpy.random numpy.random.seed(seed) from torch import manual_seed manual_seed(seed) log.set_logger(logger, level=30-min(10*verbose, 20))
def cli(verbose, seed): if seed: import numpy.random numpy.random.seed(seed) from torch import manual_seed manual_seed(seed) log.set_logger(logger, level=30 - min(10 * verbose, 20))
def cli(input, batch_input, suffix, verbose, device): """ Base command for recognition functionality. Inputs are defined as one or more pairs `-i input_file output_file` followed by one or more chainable processing commands. Likewise, verbosity is set on all subcommands with the `-v` switch. """ ctx = click.get_current_context() ctx.meta['device'] = device log.set_logger(logger, level=30 - min(10 * verbose, 20))
def cli(input, batch_input, suffix, verbose, device): """ Base command for recognition functionality. Inputs are defined as one or more pairs `-i input_file output_file` followed by one or more chainable processing commands. Likewise, verbosity is set on all subcommands with the `-v` switch. """ ctx = click.get_current_context() ctx.meta['device'] = device log.set_logger(logger, level=30-min(10*verbose, 20))
def cli(input, batch_input, suffix, verbose, format_type, pdf_format, device, raise_on_error): """ Base command for recognition functionality. Inputs are defined as one or more pairs `-i input_file output_file` followed by one or more chainable processing commands. Likewise, verbosity is set on all subcommands with the `-v` switch. """ ctx = click.get_current_context() ctx.meta['device'] = device ctx.meta[ 'input_format_type'] = format_type if format_type != 'pdf' else 'image' ctx.meta['raise_failed'] = raise_on_error log.set_logger(logger, level=30 - min(10 * verbose, 20))
def cli(input, verbose): ctx = click.get_current_context() log.set_logger(logger, level=30-10*verbose) ctx.meta['verbose'] = verbose
def cli(verbose): log.set_logger(logger, level=30 - min(10 * verbose, 20))