From 3186c07328fd0c0ee8fac12dde7eedcac52babc0 Mon Sep 17 00:00:00 2001 From: boladeE Date: Fri, 25 Apr 2025 18:04:28 +0100 Subject: [PATCH] Refactor async functions to synchronous in main.py - Changed the 'home' and 'predict' route handlers from async to synchronous functions for improved performance and simplicity. --- src/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.py b/src/main.py index f346ee3..f227b80 100644 --- a/src/main.py +++ b/src/main.py @@ -75,7 +75,7 @@ class TransactionForm(BaseModel): merch_long: float = Field(..., description="Merchant longitude") @app.get("/", response_class=HTMLResponse) -async def home(request: Request): +def home(request: Request): """Render the home page with the transaction form.""" return templates.TemplateResponse( "index.html", @@ -83,7 +83,7 @@ async def home(request: Request): ) @app.post("/predict", response_class=HTMLResponse) -async def predict( +def predict( request: Request, trans_date_trans_time: str = Form(...), cc_num: str = Form(...),