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.
This commit is contained in:
boladeE
2025-04-25 18:04:28 +01:00
parent a70c0802ae
commit 3186c07328
+2 -2
View File
@@ -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(...),