YOLOv5 is working with USB webcam, but how can I use CSI camera?

Hi, I’m running YOLOv5 on Jetson Nano. It’s working fine with USB webcam with command -

sudo python3 detect.py --weights runs/exp24/weights/best.pt --source 1

But how can I run it with CSI camera? This command below is working to show the camera, but somehow I need to pass it to the YOLOv5 detect script.

gst-launch-1.0 nvarguscamerasrc sensor_id=0 ! \
   'video/x-raw(memory:NVMM),width=3280, height=2464, framerate=21/1, format=NV12' ! \
   nvvidconv flip-method=0 ! 'video/x-raw,width=960, height=720' ! \
   nvvidconv ! nvegltransform ! nveglglessink -e


YOLOv5 uses OpenCV to get the input camera data.
Please modify the sample via OpenCV+GStreamer.

You can find an example below: