Coverage for kwai/kwai_api.py: 0%
10 statements
« prev ^ index » next coverage.py v7.3.0, created at 2023-09-05 17:55 +0000
« prev ^ index » next coverage.py v7.3.0, created at 2023-09-05 17:55 +0000
1"""Module for starting the api server."""
2import argparse
4import uvicorn
7def create_args():
8 """Parse and create cli arguments."""
9 parser = argparse.ArgumentParser(description="kwai backend")
10 parser.add_argument(
11 "--reload",
12 action=argparse.BooleanOptionalAction,
13 help="Watch for code changes or not",
14 )
15 parser.add_argument(
16 "--port", type=int, default=8000, help="The port of the api server."
17 )
18 return parser.parse_args()
21if __name__ == "__main__":
22 args = create_args()
23 uvicorn.run(
24 "kwai.api.app:create_app",
25 host="0.0.0.0",
26 port=args.port,
27 factory=True,
28 reload=args.reload,
29 )