Files
2026-04-16 10:54:32 +08:00

26 lines
770 B
Python
Raw Permalink 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 argparse
import uvicorn
from fastapi_qa import app
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("--model_dir", type=str, default="/model",
help="模型目录(挂载到容器内的路径)")
parser.add_argument("--use_gpu", action="store_true", default=True,
help="是否使用 GPUCUDA")
parser.add_argument("--port", type=int, default=8000,
help="FastAPI 服务端口,默认 8000")
args = parser.parse_args()
app.state.config = {
"model_dir": args.model_dir,
"use_gpu": args.use_gpu,
}
uvicorn.run("fastapi_qa:app",
host="0.0.0.0",
port=args.port,
workers=1,
)