From 913ee05e744ce2d40dac4541ced820f2721c0642 Mon Sep 17 00:00:00 2001 From: hiyouga <467089858@qq.com> Date: Fri, 30 Aug 2024 02:45:40 +0800 Subject: [PATCH] fix #5307 Former-commit-id: 8b588c7224e631a96c09f3460effc5dbfca6ec14 --- src/llamafactory/api/app.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/llamafactory/api/app.py b/src/llamafactory/api/app.py index c1264617..be70a3a9 100644 --- a/src/llamafactory/api/app.py +++ b/src/llamafactory/api/app.py @@ -57,7 +57,8 @@ async def lifespan(app: "FastAPI"): # collects GPU memory def create_app(chat_model: "ChatModel") -> "FastAPI": - app = FastAPI(lifespan=lifespan) + root_path = os.environ.get("FASTAPI_ROOT_PATH", "") + app = FastAPI(lifespan=lifespan, root_path=root_path) app.add_middleware( CORSMiddleware, allow_origins=["*"],