Compare commits
No commits in common. "2b09371cbf689d816684c2f4f1191e676c955b2d" and "1e301c04c08f2dac4229c8a01d4101af80be5ad3" have entirely different histories.
2b09371cbf
...
1e301c04c0
10
src/main.py
10
src/main.py
@ -33,7 +33,7 @@ def get_root(request: Request):
|
|||||||
if request.url.path != "/":
|
if request.url.path != "/":
|
||||||
raise HTTPException(status_code=404)
|
raise HTTPException(status_code=404)
|
||||||
|
|
||||||
return render("main.html")
|
return renderTemplate("main.html")
|
||||||
|
|
||||||
|
|
||||||
@app.post("/detect/{strength}")
|
@app.post("/detect/{strength}")
|
||||||
@ -43,9 +43,6 @@ def post_detect(file: Image, strength: DetectionStrength):
|
|||||||
print("\nWorking on: " + file_name)
|
print("\nWorking on: " + file_name)
|
||||||
print("\nStrength: " + strength + "\n")
|
print("\nStrength: " + strength + "\n")
|
||||||
|
|
||||||
if not os.path.exists("data/"):
|
|
||||||
os.makedirs("data")
|
|
||||||
|
|
||||||
with open("data/" + file_name, "wb") as f:
|
with open("data/" + file_name, "wb") as f:
|
||||||
f.write(b64decode(file.file_contents))
|
f.write(b64decode(file.file_contents))
|
||||||
|
|
||||||
@ -107,5 +104,6 @@ def get_models_for_detection_strength(strength: DetectionStrength):
|
|||||||
return ["db_resnet50", "vitstr_small"]
|
return ["db_resnet50", "vitstr_small"]
|
||||||
|
|
||||||
|
|
||||||
def render(template, context={}):
|
def renderTemplate(template, context={}):
|
||||||
return HTMLResponse(env.get_template(template).render(context))
|
template = env.get_template(template)
|
||||||
|
return HTMLResponse(template.render(context))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user