Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -33,7 +33,9 @@ def predict_image(image, confidence, overlap):
|
|
33 |
|
34 |
img = Image.open(image).convert("RGB")
|
35 |
|
36 |
-
|
|
|
|
|
37 |
|
38 |
draw = ImageDraw.Draw(img)
|
39 |
font = ImageFont.load_default(size=30)
|
@@ -44,10 +46,10 @@ def predict_image(image, confidence, overlap):
|
|
44 |
x1 = result['x'] + result['width'] / 2
|
45 |
y1 = result['y'] + result['height'] / 2
|
46 |
|
47 |
-
x0 *=
|
48 |
-
y0 *=
|
49 |
-
x1 *=
|
50 |
-
y1 *=
|
51 |
|
52 |
for i in range(len(pest_class)):
|
53 |
if result['class'] == pest_class[i]:
|
|
|
33 |
|
34 |
img = Image.open(image).convert("RGB")
|
35 |
|
36 |
+
resize_img = 1
|
37 |
+
|
38 |
+
img = img.resize((img.width * 1.5, img.height * resize_img))
|
39 |
|
40 |
draw = ImageDraw.Draw(img)
|
41 |
font = ImageFont.load_default(size=30)
|
|
|
46 |
x1 = result['x'] + result['width'] / 2
|
47 |
y1 = result['y'] + result['height'] / 2
|
48 |
|
49 |
+
x0 *= resize_img
|
50 |
+
y0 *= resize_img
|
51 |
+
x1 *= resize_img
|
52 |
+
y1 *= resize_img
|
53 |
|
54 |
for i in range(len(pest_class)):
|
55 |
if result['class'] == pest_class[i]:
|