|
|
@@ -4,6 +4,7 @@
|
|
|
配置文件 v2 - 从配置文件读取配置(不使用环境变量)
|
|
|
"""
|
|
|
|
|
|
+import os
|
|
|
from .config_loader import get_config_loader
|
|
|
from .utils.device_env import detect_device_kind
|
|
|
|
|
|
@@ -16,7 +17,7 @@ _device_kind_from_config = _config.get_str("device_kind", "")
|
|
|
DEVICE_KIND = _device_kind_from_config if _device_kind_from_config else detect_device_kind()
|
|
|
|
|
|
# 默认模型配置
|
|
|
-DEFAULT_MODEL_NAME = _config.get_str("default_model_name", "OpenDataLab/MinerU2.5-2509-1.2B")
|
|
|
+DEFAULT_MODEL_NAME = "OpenDataLab/MinerU2.5-2509-1.2B"
|
|
|
DEFAULT_GPU_MEMORY_UTILIZATION = _config.get_float("default_gpu_memory_utilization", 0.9)
|
|
|
DEFAULT_DPI = _config.get_int("default_dpi", 200)
|
|
|
DEFAULT_MAX_PAGES = _config.get_int("default_max_pages", 10)
|
|
|
@@ -34,28 +35,10 @@ DEFAULT_RETURN_MODEL_OUTPUT = _config.get_bool("return_model_output", True)
|
|
|
DEFAULT_RETURN_MD = _config.get_bool("return_md", True)
|
|
|
DEFAULT_RETURN_IMAGES = _config.get_bool("return_images", False)
|
|
|
DEFAULT_RETURN_CONTENT_LIST = _config.get_bool("return_content_list", False)
|
|
|
-DEFAULT_SERVER_URL = _config.get_str("server_url", "string")
|
|
|
-
|
|
|
-# API 服务启动配置
|
|
|
-API_HOST = _config.get_str("api_host", "0.0.0.0")
|
|
|
-API_PORT = _config.get_int("api_port", 4214)
|
|
|
-
|
|
|
-# MinerU 服务管理配置
|
|
|
-MINERU_API_HOST = _config.get_str("mineru_api_host", "127.0.0.1")
|
|
|
-MINERU_API_PORT = _config.get_int("mineru_api_port", 5282)
|
|
|
-MINERU_IDLE_TIMEOUT = _config.get_int("mineru_idle_timeout", 60)
|
|
|
-MINERU_CHECK_INTERVAL = _config.get_int("mineru_check_interval", 60)
|
|
|
-MINERU_START_TIMEOUT = _config.get_int("mineru_start_timeout", 120)
|
|
|
-
|
|
|
-# PaddleOCR 配置
|
|
|
-PADDLEOCR_CMD = _config.get_str("paddleocr_cmd", "paddleocr")
|
|
|
-PADDLE_OCR_DEVICE = _config.get_str("paddle_ocr_device", "")
|
|
|
-PADDLE_OCR_DEVICES = _config.get_str("paddle_ocr_devices", "")
|
|
|
-PADDLE_DOC_PARSER_CMD = _config.get_str("paddle_doc_parser_cmd", "paddleocr")
|
|
|
+DEFAULT_SERVER_URL = os.getenv("SERVER_URL", "string")
|
|
|
|
|
|
# 日志配置(可选)
|
|
|
LOG_DIR = _config.get_str("log_dir", "./logs")
|
|
|
LOG_LEVEL = _config.get_str("log_level", "INFO")
|
|
|
LOG_TO_FILE = _config.get_bool("log_to_file", True)
|
|
|
LOG_TO_CONSOLE = _config.get_bool("log_to_console", True)
|
|
|
-
|