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:
+2
-2
@@ -75,7 +75,7 @@ class TransactionForm(BaseModel):
|
|||||||
merch_long: float = Field(..., description="Merchant longitude")
|
merch_long: float = Field(..., description="Merchant longitude")
|
||||||
|
|
||||||
@app.get("/", response_class=HTMLResponse)
|
@app.get("/", response_class=HTMLResponse)
|
||||||
async def home(request: Request):
|
def home(request: Request):
|
||||||
"""Render the home page with the transaction form."""
|
"""Render the home page with the transaction form."""
|
||||||
return templates.TemplateResponse(
|
return templates.TemplateResponse(
|
||||||
"index.html",
|
"index.html",
|
||||||
@@ -83,7 +83,7 @@ async def home(request: Request):
|
|||||||
)
|
)
|
||||||
|
|
||||||
@app.post("/predict", response_class=HTMLResponse)
|
@app.post("/predict", response_class=HTMLResponse)
|
||||||
async def predict(
|
def predict(
|
||||||
request: Request,
|
request: Request,
|
||||||
trans_date_trans_time: str = Form(...),
|
trans_date_trans_time: str = Form(...),
|
||||||
cc_num: str = Form(...),
|
cc_num: str = Form(...),
|
||||||
|
|||||||
Reference in New Issue
Block a user