STT_Server/main.py

19 lines
660 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 uvicorn
from src.server import app
from src.utils.logger import get_module_logger, setup_root_logger
from datetime import datetime
time = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
setup_root_logger(level="INFO", log_file=f"logs/main_{time}.log")
logger = get_module_logger(__name__)
if __name__ == "__main__":
logger.info("启动 FunASR FastAPI 服务器...")
# 在生产环境中推荐使用更强大的ASGI服务器如Gunicorn并配合Uvicorn workers。
# 例如: gunicorn -w 4 -k uvicorn.workers.UvicornWorker main:app
uvicorn.run(
app,
host="0.0.0.0",
port=8000,
log_level="info"
)