Be more specific about where to write the outfile
This commit is contained in:
parent
50a22caea1
commit
9dd9e38eab
|
@ -125,15 +125,17 @@ def analyze_image(request: Request, image: UploadFile):
|
||||||
chunk = image.file.read(buffer_size)
|
chunk = image.file.read(buffer_size)
|
||||||
print("save complete")
|
print("save complete")
|
||||||
print("analyzing image")
|
print("analyzing image")
|
||||||
result = detector.detect_objects(infile, file_hash.hexdigest() + ".png")
|
result = detector.detect_objects(
|
||||||
|
infile,
|
||||||
|
str(outgoing_dir / (file_hash.hexdigest() + ".png")))
|
||||||
print("image analyzed")
|
print("image analyzed")
|
||||||
remove(infile)
|
remove(infile)
|
||||||
return result_to_dict(result, base_url)
|
return result_to_dict(result, base_url)
|
||||||
|
|
||||||
@app.get("/analyzed_images/${image_name}", response_class=FileResponse)
|
@app.get("/analyzed_images/{image_name}", response_class=FileResponse)
|
||||||
def get_analyzed_image(image_name):
|
def get_analyzed_image(image_name: str):
|
||||||
filename = str(outgoing_dir / image_name)
|
filename = outgoing_dir / image_name
|
||||||
if path.isfile(filename):
|
if path.isfile(filename):
|
||||||
return filename
|
return str(filename)
|
||||||
else:
|
else:
|
||||||
raise HTTPException(status_code=404, detail="file not found: " + filename)
|
raise HTTPException(status_code=404, detail="file not found: " + str(filename))
|
||||||
|
|
Loading…
Reference in New Issue