Yudsky commited on
Commit
50389da
·
verified ·
1 Parent(s): 8ffc0ca

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -5
app.py CHANGED
@@ -33,7 +33,9 @@ def predict_image(image, confidence, overlap):
33
 
34
  img = Image.open(image).convert("RGB")
35
 
36
- img = img.resize((img.width * 1.5, img.height * 1.5))
 
 
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 *= 1.5
48
- y0 *= 1.5
49
- x1 *= 1.5
50
- y1 *= 1.5
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]: