Spaces:
Running
Running
Upload app.py
Browse files
app.py
CHANGED
|
@@ -99,9 +99,12 @@ async def predict_age_gender(file: UploadFile = File(...)):
|
|
| 99 |
limg = cv2.merge((cl, a_channel, b_channel))
|
| 100 |
img = cv2.cvtColor(limg, cv2.COLOR_LAB2BGR)
|
| 101 |
|
|
|
|
|
|
|
|
|
|
| 102 |
# Run MiVOLO prediction directly on the numpy image array
|
| 103 |
pred = get_predictor()
|
| 104 |
-
detected_objects, _ = pred.recognize(
|
| 105 |
|
| 106 |
if detected_objects is None or not detected_objects.ages:
|
| 107 |
raise HTTPException(
|
|
|
|
| 99 |
limg = cv2.merge((cl, a_channel, b_channel))
|
| 100 |
img = cv2.cvtColor(limg, cv2.COLOR_LAB2BGR)
|
| 101 |
|
| 102 |
+
# Convert BGR (OpenCV default) to RGB (MiVOLO expectation)
|
| 103 |
+
img_rgb = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
|
| 104 |
+
|
| 105 |
# Run MiVOLO prediction directly on the numpy image array
|
| 106 |
pred = get_predictor()
|
| 107 |
+
detected_objects, _ = pred.recognize(img_rgb)
|
| 108 |
|
| 109 |
if detected_objects is None or not detected_objects.ages:
|
| 110 |
raise HTTPException(
|