File size: 2,170 Bytes
6d4ec85
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import os
import shutil
import toml
from loguru import logger

root_dir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))
config_file = f"{root_dir}/config.toml"

def load_config():
    """Simplified config loading for faster startup"""
    # Skip directory check and example file copying for speed
    if not os.path.isfile(config_file):
        logger.warning(f"Config file not found: {config_file}, using defaults")
        return {
            "app": {"max_concurrent_tasks": 1, "api_enabled": True},
            "ui": {"hide_log": False},
            "azure": {},
            "siliconflow": {},
            "whisper": {},
            "proxy": {}
        }
    
    try:
        return toml.load(config_file)
    except Exception as e:
        logger.warning(f"Config load failed: {e}, using defaults")
        return {
            "app": {"max_concurrent_tasks": 1, "api_enabled": True},
            "ui": {"hide_log": False},
            "azure": {},
            "siliconflow": {},
            "whisper": {},
            "proxy": {}
        }

def save_config():
    """Save current config to file"""
    try:
        with open(config_file, "w", encoding="utf-8") as f:
            _cfg["app"] = app
            _cfg["azure"] = azure
            _cfg["siliconflow"] = siliconflow
            _cfg["ui"] = ui
            f.write(toml.dumps(_cfg))
    except Exception as e:
        logger.warning(f"Failed to save config: {e}")

# Load config with minimal overhead
_cfg = load_config()
app = _cfg.get("app", {})
whisper = _cfg.get("whisper", {})
proxy = _cfg.get("proxy", {})
azure = _cfg.get("azure", {})
siliconflow = _cfg.get("siliconflow", {})
ui = _cfg.get("ui", {"hide_log": False})

# Minimal project info
project_name = "MoneyPrinterTurbo"
project_version = "1.2.6"
project_description = "AI Video Generator"

# HF Spaces optimized settings
log_level = "INFO"  # Reduce log verbosity
listen_host = "0.0.0.0"
listen_port = 8080
reload_debug = False

# Skip ImageMagick and FFmpeg path setup for faster startup
# These will be handled by the system packages
logger.info(f"{project_name} v{project_version} - Huggingface Spaces")