def gen(camera): sec = 0 while True: frame = camera.get_frame() yield (b'--frame\r\n' b'Content-Type: image/jpeg\r\n\r\n' + frame + b'\r\n\r\n') predicted_emotion = 'alhamduela' time.sleep(1) sec += 1 if sec % 5 == 0 and sec > 4: VideoCamera.throwData()
def video_feed(request): return StreamingHttpResponse(gen(VideoCamera()), content_type='multipart/x-mixed-replace; boundary=frame')