first cimmit

This commit is contained in:
zcr
2026-01-26 10:16:47 +08:00
commit 71400cff38
12 changed files with 2026 additions and 0 deletions

25
main.py Normal file
View File

@@ -0,0 +1,25 @@
import logging
import os
import litserve as ls
from app.config.config import settings
from logging_env import LOGGER_CONFIG_DICT
from app.server.generate_image.flux2_klein.server import Flux2KleinServer
logger = logging.getLogger(__name__)
# 判断目录是否存在
logs = 'logs'
if not os.path.exists(logs):
# 不存在则创建目录parents=True 允许创建多级目录exist_ok=True 避免目录已存在时报错)
os.makedirs(logs, exist_ok=True)
logger.info(f"目录 {logs} 创建成功")
else:
logger.info(f"目录 {logs} 已存在")
logging.config.dictConfig(LOGGER_CONFIG_DICT)
if __name__ == '__main__':
to_product = Flux2KleinServer(api_path='/api/v1/to_product')
server = ls.LitServer([to_product])
server.run(port=settings.SERVE_PROD)