Files
AiDA_Model_Litserve/app/main.py
2026-01-26 11:40:11 +08:00

25 lines
739 B
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import logging
import os
import litserve as ls
from app.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=8888)