Spaces:
Sleeping
Sleeping
| # C:/facefusion/facefusion/ui_preference.py | |
| import json | |
| import os | |
| from facefusion import logger | |
| def get_config_path() -> str: | |
| config_dir = os.path.join(os.path.expanduser('~'), '.facefusion') | |
| os.makedirs(config_dir, exist_ok=True) | |
| return os.path.join(config_dir, 'ui_preference.json') | |
| def save_ui_preference(ui_type: str) -> None: | |
| config_path = get_config_path() | |
| try: | |
| with open(config_path, 'w') as f: | |
| json.dump({'ui_type': ui_type}, f) | |
| except Exception as e: | |
| logger.error("Не удалось сохранить настройки UI: %s", e) | |
| def get_ui_preference() -> str: | |
| config_path = get_config_path() | |
| try: | |
| with open(config_path, 'r') as f: | |
| return json.load(f).get('ui_type', 'original') | |
| except: | |
| return 'original' # По умолчанию |