mirror of
https://github.com/azaion/detections.git
synced 2026-04-22 10:56:32 +00:00
[AZ-177] Remove redundant synchronous video pre-writes in /detect endpoint
Made-with: Cursor
This commit is contained in:
+3
-4
@@ -391,8 +391,9 @@ async def detect_image(
|
||||
if not ext.startswith("."):
|
||||
ext = "." + ext
|
||||
storage_path = os.path.abspath(os.path.join(base, f"{content_hash}{ext}"))
|
||||
with open(storage_path, "wb") as out:
|
||||
out.write(image_bytes)
|
||||
if kind == "image":
|
||||
with open(storage_path, "wb") as out:
|
||||
out.write(image_bytes)
|
||||
mt = "Video" if kind == "video" else "Image"
|
||||
payload = {
|
||||
"id": content_hash,
|
||||
@@ -426,8 +427,6 @@ async def detect_image(
|
||||
suf = ext if ext.startswith(".") else ".mp4"
|
||||
fd, tmp_video_path = tempfile.mkstemp(suffix=suf)
|
||||
os.close(fd)
|
||||
with open(tmp_video_path, "wb") as f:
|
||||
f.write(image_bytes)
|
||||
save = tmp_video_path
|
||||
inf.run_detect_video(image_bytes, ai_cfg, media_name, save, on_annotation)
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user