first cimmit
This commit is contained in:
24
app/main.py
Normal file
24
app/main.py
Normal file
@@ -0,0 +1,24 @@
|
||||
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)
|
||||
Reference in New Issue
Block a user