yoloKYS commited on
Commit
66bc972
·
verified ·
1 Parent(s): 19e855b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -8
app.py CHANGED
@@ -4,17 +4,16 @@ from PIL import Image
4
  import numpy as np
5
 
6
  # Load YOLOv12 model
7
- model = YOLO("best.pt") # model in repo
8
 
9
  def predict(image):
10
- # Ensure RGB and convert to NumPy array
11
- image = image.convert("RGB")
12
- img_array = np.array(image)
13
-
14
  # Run inference
15
- results = model.predict(img_array)
16
-
17
- # Annotate and return
18
  annotated_img = results[0].plot()
19
  return annotated_img
20
 
 
4
  import numpy as np
5
 
6
  # Load YOLOv12 model
7
+ model = YOLO("best.pt")
8
 
9
  def predict(image):
10
+ # Ensure RGB and convert to NumPy
11
+ img_array = np.array(image.convert("RGB"))
12
+
 
13
  # Run inference
14
+ results = model.predict(img_array, imgsz=640) # specify size for safety
15
+
16
+ # Annotate image
17
  annotated_img = results[0].plot()
18
  return annotated_img
19