Skip to content

Commit

Permalink
fixed auth
Browse files Browse the repository at this point in the history
  • Loading branch information
AlejandroEsquivel committed Aug 15, 2024
1 parent 06b084b commit 1754974
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions inference/serving-non-optimized-fastapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,13 @@ def tgi_app():

volume.reload() # ensure we have the latest version of the weights

web_app = fastapi.FastAPI()
app = fastapi.FastAPI()

http_bearer = fastapi.security.HTTPBearer(
scheme_name="Bearer Token",
description="See code for authentication details.",
)
web_app.add_middleware(
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=True,
Expand All @@ -140,7 +140,7 @@ class ChatClassificationRequestBody(BaseModel):
chat: List[ChatMessages]


@web_app.post("/v1/chat/classification")
@router.post("/v1/chat/classification")
async def chat_classification_response(body: ChatClassificationRequestBody):
chat = body.model_dump().get("chat",[])

Expand All @@ -167,7 +167,8 @@ async def chat_classification_response(body: ChatClassificationRequestBody):
}


return web_app
app.include_router(router)
return app


# @app.local_entrypoint()
Expand Down

0 comments on commit 1754974

Please sign in to comment.