Spaces:
Sleeping
Sleeping
Update app.py
Browse files12344567891011111213141516171818192021import gradio as grimport cv2from ultralytics import YOLO
pothole_count = 0# Load your custom trained modelmodel = YOLO("best.pt")
def detect(frame): # If the frame is empty (can happen during stream initialization), return None if frame is None: return None, 0 return None, pothole_count+0
# ---> THIS IS THE MAGIC FIX <--- # Create a writable copy of the read-only array provided by Gradio frame = frame.copy()
results = model(frame, conf=0.4) pothole_count = 0
for r in results: if r.boxes is not None:app.py+3-3