Commit 83b09c6e authored by Vít Starý Novotný's avatar Vít Starý Novotný
Browse files

Add configuration parameters that control the default parameters of CLI

parent d998cfeb
Loading
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -3,6 +3,7 @@ from logging import getLogger
from typing import List, Optional
from pathlib import Path

from .config import CONFIG as _CONFIG
from .util import create_temporary_docker_volume
from .volume import copy_input_to, copy_output_from
from .preprocessing import apply_super_resolution
@@ -13,6 +14,7 @@ import docker


LOGGER = getLogger(__name__)
CONFIG = _CONFIG['cli']


@click.command()
@@ -24,22 +26,22 @@ LOGGER = getLogger(__name__)
                required=True)
@click.option('--google-vision-ai',
              help='Use Google Vision AI in addition to Tesseract for OCR (recommended, requires paid account)',
              default=False,
              default=bool(CONFIG.getint('google_vision_ai')),
              is_flag=True,
              required=False)
@click.option('--google-api-key',
              help='A file with the API key for the Google Vision AI',
              type=click.Path(exists=True, dir_okay=False, file_okay=True),
              default=None,
              default=CONFIG['google_api_key'] if 'google_api_key' in CONFIG else None,
              required=False)
@click.option('--super-resolution',
              help='Use image super-resolution before the OCR (recommended, requires GPU)',
              default=False,
              default=bool(CONFIG.getint('super_resolution')),
              is_flag=True,
              required=False)
@click.option('--gpus',
              help='Comma-separated PCI BUS IDs of NVIDIA GPUs that will be used for image super-resolution',
              default='all',
              default=CONFIG['gpus'],
              required=False)
def main(input_dir: str, output_dir: str, google_vision_ai: bool,
         google_api_key: Optional[str], super_resolution: bool, gpus: str) -> None:
+5 −0
Original line number Diff line number Diff line
[cli]
google_vision_ai = 0
super_resolution = 0
gpus = all

[preprocessing]
model = anime_style_art_rgb
noise_level = 3