Team Ai
Apppublic

radames/Text2Human-API

sourceHugging Faceupdated 3y agoView on Hugging Face
1likes
config.py26 linesDownload Raw Back to ui_util
1import argparse2import logging3import os4 5import yaml6 7logger = logging.getLogger()8 9class Config(object):10    def __init__(self, filename=None):11        assert os.path.exists(filename), "ERROR: Config File doesn't exist."12        try:13            with open(filename, 'r') as f:14                self._cfg_dict = yaml.load(f)15        # parent of IOError, OSError *and* WindowsError where available16        except EnvironmentError:17            logger.error('Please check the file with name of "%s"', filename)18        logger.info(' APP CONFIG '.center(80, '-'))19        logger.info(''.center(80, '-'))20 21    def __getattr__(self, name):22        value = self._cfg_dict[name]23        if isinstance(value, dict):24            value = DictAsMember(value)25        return value26