Spaces:
Sleeping
Sleeping
| import os | |
| import json | |
| import logging | |
| import configparser | |
| ROOT_PATH = os.path.split(os.path.split(os.path.abspath(__file__))[0])[0] | |
| def load_json(fp, encoding='utf-8', json_lines=False): | |
| with open(fp, encoding=encoding) as fin: | |
| if not json_lines: | |
| return json.load(fin) | |
| else: | |
| return [json.loads(line) for line in fin] | |
| def read_config(): | |
| config_file = ROOT_PATH + "\conf\config.ini" | |
| config_ini = configparser.ConfigParser() | |
| config_ini.read(config_file) | |
| model_name = "DouBao128Pro" | |
| return config_ini | |
| def read_json(filepath): | |
| with open(filepath, 'r') as f: | |
| result = json.load(f) | |
| return result | |