File size: 815 Bytes
3989022
 
 
670fc2f
3989022
 
670fc2f
3989022
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# -*- coding: utf-8 -*-

from pathlib import Path

from teklia_toolbox.config import ConfigParser


def parse_configurations(config_path: Path):
    """
    Parse multiple JSON configuration files into a single source
    of configuration for the HuggingFace app

    :param config_path: pathlib.Path, Path to the .json config file
    :return: dict, containing the configuration. Ensures config is complete and with correct typing
    """

    parser = ConfigParser()

    parser.add_option(
        "model_name", type=str, default="doc-ufcn-generic-historical-line"
    )
    parser.add_option("classes_colors", type=list, default=["green"])
    parser.add_option("title", type=str)
    parser.add_option("description", type=str)
    parser.add_option("examples", type=list)

    return parser.parse(config_path)