In the previous part we have seen that how we can integrate YOLO V8 with flask and run on a video.
So now we will see that how we can run on a live webcam feed.
So to run on the live webcam feed, just change in the video path in the path dash x to zero.
So I will just end this out.
And in in this if just uncomment it.
So now you can see over here in the path dash x I have just entered zero and I have just removed this
part of the video path.
I will have just removed the video path from here and just replaced it with zero.
So by replacing this video path with zero, we will be able to run this on the live web can see it.
So in the previous video we have already seen that how we can integrate YOLO V8 with flask.
So by just replacing the video path with zero, we will be able to run this on the live webcam feed.
So just write python just so now just run this script.
Python flask app.py file.
And now we will be able to run this on the live webcam feed.
So this might take few seconds as well.
So.
Next, we just click out this part.
Okay.
Uh, before I just run this, let me just stop this from here.
And instead of doing this, let me just.
Rent this out and uncomment this.
Let's create a new URL to run this on a live webcam feed.
So just copy this from here.
And.
Just right here where care and just replace this path with zero.
So if we just replace this path with zero, we will be able to run this on live webcam feed.
So I've just replaced the video path with zero.
So instead of just accommodating into the video URL, I have just created another URL by the name webcam.
So here using apt route method, I've just created a webcam, so and just in the path dash x, I have
just removed this video path and added zero so that I will be able to run this on the live webcam feed.
So just run this now.
Well, now, when will this call this webcam?
I will be able to run this on the live webcam feed and do the detections.
Or what is the error?
Okay, so we just need to change this function.
We cannot have two functions by the same name like we do.
So now just run this again.
So now we are just running the class app.py file.
So now we see that we are able to do the detections on the live webcam feed or not.
So just copy this URL from here, copy URL and just go over here and just write this and dash webcam
and see if we are able to detect the detections on the live webcam feed or not.
So let's see, how does it work?
So I'm just also waiting with you.
And now you can see over here we are able to track actions on the live webcam feed.
Okay.
So you can see over here, you can see that a bounding box around me and the label person with the confidence
score of here as well.
We'll wait and see that.
Now, you can see here on the back side have the sofa and it's directing as the sofa.
Okay.
And here I have the tab is able to retract the tab or not.
Let's see.
Well, now you can see over here, it's directing the tablet as the laptop, although it's a tablet.
So that's okay as well.
So now you can see over here, it's working quite fine on the live webcam feed as well.
We can can see that on the bounding box around me and the paper as well.
So the results are good.
Okay.
So now you can see over here we are able to run this on the live webcam feed as well.
And the results are quite impressive.
So if you just want to run on video, so just need to go over here and we'll just refresh this, the
URL we have already added, so we'll just refresh this dash video URL and see if you are able to do
the detections on the video or not.
So now if I just call this dash video, you can see over here we are able to do detections on the video.
So you can see over here we have drawn the bounding box around the person with the label and the confidence
score.
And we have drawn the bounding box around the bicycle with the label bicycle and the confidence score
over here as well.
So that's quite impressive.
We have also detected a traffic light.
We have drawn the bounding box and here we have a label traffic light.
So now you can see over here we are here we are getting that car and we have a label car and we have
the confidence score over here as well.
And here we are just getting the person and we have the confidence score.
And here we are also detecting the motorbike.
We have the label motorbike and the confidence score as well.
So now we have seen that how we can integrate YOLO V8 with Flask and do the detections on the video
or live webcam feed as well.
So we have integrated YOLO V8 with flask and I was able to detections on video and on the live webcam
feed.
So now in the next video we will see that how we can create an HTML page and make this more.
If you like, we can talk again further, polish this and create a complete HTML web page and do the
styling using CSS.
So see you all in the next part.