Relative Content

Tag Archive for pythonajaxflaskasynchronousvideo-streaming

Ajax requests interfering with video stream function in Flask despite multithreading

I’m designing a web application. One of the main functions annotates frames from a webcam stream with the landmarks of different parts of the body (using Mediapipe). It then calculates the angle between the different parts of the arm (depending on how sure the Mediapipe AI is of having correctly located the landmark) and then yields a list that contains whether or not it could succesfully calculate angles, image data, and possibly the angles and rotation of the different parts of the arm to the central Flask function (views.py). There the list is processed and passed on to a html file that displays the image data. All this works fine. There is however also a button for Ajax requests. These are also being handled well by views.py, However the annotating function stops as soon as an Ajax request is made.