LiamKhoaLe commited on
Commit
e3fe9bf
·
1 Parent(s): 56ce5ee
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -331,12 +331,12 @@ async def detect_animals(file: UploadFile = File(...)):
331
  results = model_animal(image)[0]
332
  for box in results.boxes:
333
  conf = box.conf[0].item()
334
- if conf >= 0.75:
335
  cls_id = int(box.cls[0].item())
336
  label = model_animal.names[cls_id].lower()
337
  if label in ["dog", "cat", "cow", "horse", "elephant", "bear", "zebra", "giraffe", "bird"]:
338
  x1, y1, x2, y2 = map(int, box.xyxy[0].tolist())
339
- detections.append(((x1, y1, x2, y2), "Animal Alert"))
340
  except Exception as e:
341
  print("[YOLOv8 Error]", e)
342
 
 
331
  results = model_animal(image)[0]
332
  for box in results.boxes:
333
  conf = box.conf[0].item()
334
+ if conf >= 0.70:
335
  cls_id = int(box.cls[0].item())
336
  label = model_animal.names[cls_id].lower()
337
  if label in ["dog", "cat", "cow", "horse", "elephant", "bear", "zebra", "giraffe", "bird"]:
338
  x1, y1, x2, y2 = map(int, box.xyxy[0].tolist())
339
+ detections.append(((x1, y1, x2, y2), f"Animal Alert {conf}"))
340
  except Exception as e:
341
  print("[YOLOv8 Error]", e)
342