Hack the filename + url
This commit is contained in:
parent
9dd9e38eab
commit
a312942a0d
@ -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
|
from os.path import getatime, splitext, basename
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
from time import sleep
|
from time import sleep
|
||||||
@ -87,7 +87,7 @@ def result_to_dict(res, base_url):
|
|||||||
return {
|
return {
|
||||||
"labels": list(map(lambda d: d.label, res.detections)),
|
"labels": list(map(lambda d: d.label, res.detections)),
|
||||||
"detections": list(map(detection_to_dict, res.detections)),
|
"detections": list(map(detection_to_dict, res.detections)),
|
||||||
"output": base_url + res.outfile,
|
"output": base_url + basename(res.outfile),
|
||||||
}
|
}
|
||||||
|
|
||||||
# @app.put("/images")
|
# @app.put("/images")
|
||||||
|
Loading…
Reference in New Issue
Block a user