Team Ai
Apppublic

Shellbrady/LivePortrait5

sourceHugging Faceupdated 2y agoView on Hugging Face
0likes
base_config.py30 linesDownload Raw Back to config
1# coding: utf-82 3"""4pretty printing class5"""6 7from __future__ import annotations8import os.path as osp9from typing import Tuple10 11 12def make_abs_path(fn):13    return osp.join(osp.dirname(osp.realpath(__file__)), fn)14 15 16class PrintableConfig:  # pylint: disable=too-few-public-methods17    """Printable Config defining str function"""18 19    def __repr__(self):20        lines = [self.__class__.__name__ + ":"]21        for key, val in vars(self).items():22            if isinstance(val, Tuple):23                flattened_val = "["24                for item in val:25                    flattened_val += str(item) + "\n"26                flattened_val = flattened_val.rstrip("\n")27                val = flattened_val + "]"28            lines += f"{key}: {str(val)}".split("\n")29        return "\n    ".join(lines)30