We didn't actually import `path`
This commit is contained in:
parent
a312942a0d
commit
6bf366b68a
|
@ -4,7 +4,7 @@ from detector import Detector
|
||||||
from fastapi import FastAPI, HTTPException, Request, UploadFile, File
|
from fastapi import FastAPI, HTTPException, Request, UploadFile, File
|
||||||
from fastapi.responses import FileResponse
|
from fastapi.responses import FileResponse
|
||||||
from os import listdir, remove
|
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 pathlib import Path
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
from time import sleep
|
from time import sleep
|
||||||
|
@ -135,7 +135,7 @@ def analyze_image(request: Request, image: UploadFile):
|
||||||
@app.get("/analyzed_images/{image_name}", response_class=FileResponse)
|
@app.get("/analyzed_images/{image_name}", response_class=FileResponse)
|
||||||
def get_analyzed_image(image_name: str):
|
def get_analyzed_image(image_name: str):
|
||||||
filename = outgoing_dir / image_name
|
filename = outgoing_dir / image_name
|
||||||
if path.isfile(filename):
|
if isfile(filename):
|
||||||
return str(filename)
|
return str(filename)
|
||||||
else:
|
else:
|
||||||
raise HTTPException(status_code=404, detail="file not found: " + str(filename))
|
raise HTTPException(status_code=404, detail="file not found: " + str(filename))
|
||||||
|
|
Loading…
Reference in New Issue