Spaces:
Runtime error
Runtime error
phuochungus
commited on
Commit
•
4f3205b
1
Parent(s):
494a6d9
reset
Browse files- app/routers/image.py +6 -6
app/routers/image.py
CHANGED
@@ -18,14 +18,14 @@ async def handleImageRequest(
|
|
18 |
):
|
19 |
try:
|
20 |
img = imfrombytes(file, cv2.IMREAD_COLOR)
|
21 |
-
|
22 |
-
|
|
|
23 |
|
24 |
-
|
25 |
-
|
26 |
-
return
|
27 |
|
28 |
-
img = inferenceImage(img, threshold, raw)
|
29 |
ret, jpeg = cv2.imencode(".jpg", img)
|
30 |
|
31 |
if not ret:
|
|
|
18 |
):
|
19 |
try:
|
20 |
img = imfrombytes(file, cv2.IMREAD_COLOR)
|
21 |
+
if raw:
|
22 |
+
bboxes, labels = inferenceImage(img, threshold, True)
|
23 |
+
return {"bboxes": bboxes.tolist(), "labels": labels.tolist()}
|
24 |
|
25 |
+
img = inferenceImage(img, threshold, False)
|
26 |
+
except:
|
27 |
+
return Response(content="Failed to read image", status_code=400)
|
28 |
|
|
|
29 |
ret, jpeg = cv2.imencode(".jpg", img)
|
30 |
|
31 |
if not ret:
|