from ultralytics import YOLO
model = YOLO('best.pt')
results = model(source = 0, show=True, conf=0.4, save=
True)
The problem with this code is this code continuously runs and it can be terminated by pressing control + c. But i have tried many methods to automatically terminate the code after 20 seconds but none of the techniques are working. Is there a way to do so?