Spaces:
Running
Running
Upload app.py
Browse files
app.py
CHANGED
|
@@ -91,14 +91,9 @@ async def predict_age_gender(file: UploadFile = File(...)):
|
|
| 91 |
if img is None:
|
| 92 |
raise HTTPException(status_code=400, detail="Invalid or unreadable image file.")
|
| 93 |
|
| 94 |
-
#
|
| 95 |
-
with tempfile.NamedTemporaryFile(suffix=".jpg", delete=False) as tmp:
|
| 96 |
-
tmp_path = tmp.name
|
| 97 |
-
cv2.imwrite(tmp_path, img)
|
| 98 |
-
|
| 99 |
-
# Run MiVOLO prediction
|
| 100 |
pred = get_predictor()
|
| 101 |
-
detected_objects, _ = pred.recognize(
|
| 102 |
|
| 103 |
if detected_objects is None or not detected_objects.ages:
|
| 104 |
raise HTTPException(
|
|
|
|
| 91 |
if img is None:
|
| 92 |
raise HTTPException(status_code=400, detail="Invalid or unreadable image file.")
|
| 93 |
|
| 94 |
+
# Run MiVOLO prediction directly on the numpy image array
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 95 |
pred = get_predictor()
|
| 96 |
+
detected_objects, _ = pred.recognize(img)
|
| 97 |
|
| 98 |
if detected_objects is None or not detected_objects.ages:
|
| 99 |
raise HTTPException(
|