coba deh
Browse files
main.py
CHANGED
@@ -64,7 +64,7 @@ async def predict_image(file: UploadFile = File(...)):
|
|
64 |
results[i]["mask"] = image_to_base64(results[i]["mask"])
|
65 |
if results[i]["label"] == "background":
|
66 |
continue
|
67 |
-
mask_area = calculate_mask_area(results[i]["mask"])
|
68 |
print(f"{results[i]['label']} area: {mask_area}")
|
69 |
score = mask_area / (500 * 500 - background_area)
|
70 |
results[i]["score"] = score
|
|
|
64 |
results[i]["mask"] = image_to_base64(results[i]["mask"])
|
65 |
if results[i]["label"] == "background":
|
66 |
continue
|
67 |
+
mask_area = calculate_mask_area(results[i]["mask"].convert("L"))
|
68 |
print(f"{results[i]['label']} area: {mask_area}")
|
69 |
score = mask_area / (500 * 500 - background_area)
|
70 |
results[i]["score"] = score
|