forked from TaurusYin/ml-assignment
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.py
More file actions
26 lines (20 loc) · 655 Bytes
/
run.py
File metadata and controls
26 lines (20 loc) · 655 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
from modules.config import GlobalConfig, ConfigFactory
import logging
import uvicorn
import asyncio
logger = logging.getLogger(__name__)
global_config = GlobalConfig()
app_config = ConfigFactory(global_config.ENV_STATE).get_config()
async def main():
logger.info(f"Starting serving at {app_config.APP_IPADDR}:{app_config.APP_PORT}")
config = uvicorn.Config(
"modules.app:app",
host=app_config.APP_IPADDR.compressed,
port=app_config.APP_PORT,
reload=True,
reload_dirs=["modules"]
)
server = uvicorn.Server(config)
await server.serve()
if __name__ == "__main__":
asyncio.run(main())