Kiransubedi545 commited on
Commit
b205cf3
·
verified ·
1 Parent(s): 0b39968

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -8,11 +8,14 @@ model_path = MODEL_PATHS["YOLOv8n"]
8
  model = YOLO(model_path)
9
 
10
  # ---------- Detection Functions ----------
 
11
  def detect_image_fn(image, confidence):
12
  if image is None:
13
  return None
14
- output_paths = detect_from_images([image], model, confidence)
15
- return output_paths[0] if output_paths else None
 
 
16
 
17
  def detect_video_fn(video_file, confidence):
18
  if video_file is None:
 
8
  model = YOLO(model_path)
9
 
10
  # ---------- Detection Functions ----------
11
+
12
  def detect_image_fn(image, confidence):
13
  if image is None:
14
  return None
15
+ image_np = np.array(image) # Convert PIL to NumPy
16
+ results = model.predict(image_np, conf=confidence, verbose=False)
17
+ annotated = results[0].plot()
18
+ return annotated
19
 
20
  def detect_video_fn(video_file, confidence):
21
  if video_file is None: