adwdawdawadw
Browse files
main.py
CHANGED
@@ -61,10 +61,10 @@ async def predict_image(file: UploadFile = File(...)):
|
|
61 |
|
62 |
# change the mask to base64 and calculate the score
|
63 |
for i in range(len(results)):
|
|
|
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
|
|
|
61 |
|
62 |
# change the mask to base64 and calculate the score
|
63 |
for i in range(len(results)):
|
64 |
+
mask_area = calculate_mask_area(results[i]["mask"])
|
65 |
results[i]["mask"] = image_to_base64(results[i]["mask"])
|
66 |
if results[i]["label"] == "background":
|
67 |
continue
|
|
|
68 |
print(f"{results[i]['label']} area: {mask_area}")
|
69 |
score = mask_area / (500 * 500 - background_area)
|
70 |
results[i]["score"] = score
|