Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -38,7 +38,7 @@ def predict_image(image, confidence, overlap):
|
|
38 |
img = img.resize((img.width * resize_img, img.height * resize_img))
|
39 |
|
40 |
draw = ImageDraw.Draw(img)
|
41 |
-
font = ImageFont.load_default(size=
|
42 |
|
43 |
for result in prediction['predictions']:
|
44 |
x0 = result['x'] - result['width'] / 2
|
@@ -57,7 +57,7 @@ def predict_image(image, confidence, overlap):
|
|
57 |
|
58 |
label = f"{result['class']} ({result['confidence']*100:.2f}%)"
|
59 |
|
60 |
-
draw.text((x0, y0 -
|
61 |
|
62 |
if prediction['predictions'] == []:
|
63 |
img = Image.open(image)
|
|
|
38 |
img = img.resize((img.width * resize_img, img.height * resize_img))
|
39 |
|
40 |
draw = ImageDraw.Draw(img)
|
41 |
+
font = ImageFont.load_default(size=20)
|
42 |
|
43 |
for result in prediction['predictions']:
|
44 |
x0 = result['x'] - result['width'] / 2
|
|
|
57 |
|
58 |
label = f"{result['class']} ({result['confidence']*100:.2f}%)"
|
59 |
|
60 |
+
draw.text((x0, y0 - 25), label, fill=colors[i], font=font)
|
61 |
|
62 |
if prediction['predictions'] == []:
|
63 |
img = Image.open(image)
|