We didn't actually import `path`

This commit is contained in:
niten 2023-01-10 16:31:30 -08:00
parent a312942a0d
commit 6bf366b68a
1 changed files with 2 additions and 2 deletions

View File

@ -4,7 +4,7 @@ from detector import Detector
from fastapi import FastAPI, HTTPException, Request, UploadFile, File
from fastapi.responses import FileResponse
from os import listdir, remove
from os.path import getatime, splitext, basename
from os.path import getatime, splitext, basename, isfile
from pathlib import Path
from threading import Thread
from time import sleep
@ -135,7 +135,7 @@ def analyze_image(request: Request, image: UploadFile):
@app.get("/analyzed_images/{image_name}", response_class=FileResponse)
def get_analyzed_image(image_name: str):
filename = outgoing_dir / image_name
if path.isfile(filename):
if isfile(filename):
return str(filename)
else:
raise HTTPException(status_code=404, detail="file not found: " + str(filename))