refactor: render

This commit is contained in:
Mark Bailey 2024-11-04 15:29:05 -05:00
parent 1e301c04c0
commit 0af50c21ae

View File

@ -33,7 +33,7 @@ def get_root(request: Request):
if request.url.path != "/":
raise HTTPException(status_code=404)
return renderTemplate("main.html")
return render("main.html")
@app.post("/detect/{strength}")
@ -104,6 +104,5 @@ def get_models_for_detection_strength(strength: DetectionStrength):
return ["db_resnet50", "vitstr_small"]
def renderTemplate(template, context={}):
template = env.get_template(template)
return HTMLResponse(template.render(context))
def render(template, context={}):
return HTMLResponse(env.get_template(template).render(context))