How to display multiple video streams in django?

Hello. I have a code that should show a video on a django page.
I’m trying to convert it from streamlit to django, but without success.
Please tell me how to implement this? Multiple threads arrive and all of them need to be shown on one page in Django like video-wall.

Code in streamlit:

video_placeholders = [st.empty() for _ in range(3)]
for i, result in enumerate(results):
    image = result.orig_img
    detection_results = model(image)[0]
    detections = sv.Detections.from_ultralytics(detection_results)
    detections = tracker.update_with_detections(detections)

    annotated_frame = process_frame(image)
    resized_image = cv2.resize(annotated_frame, (1024, 768))
    video_placeholders[i % 3].image(resized_image, channels="BGR", use_column_width=True, caption=f"Video {i + 1}")

The Django code I’m trying shows images from all cameras in one place, but each thread should have its own display:

def video_stream(request):
    def generate_frames():
        for i, result in enumerate(results):
            image = result.orig_img
            detection_results = model(image)[0]
            detections = sv.Detections.from_ultralytics(detection_results)
            detections = tracker.update_with_detections(detections)

            annotated_frame = process_frame(image, stream_index=i)  # Pass stream_index to process_frame
            resized_image = cv2.resize(annotated_frame, (1024, 768))

            _, frame = cv2.imencode('.jpg', resized_image)
            frame = frame.tobytes()

            yield (b'--frame\r\n'
                   b'Content-Type: image/jpeg\r\n\r\n' + frame + b'\r\n\r\n')

    return StreamingHttpResponse(generate_frames(), content_type='multipart/x-mixed-replace; boundary=frame')

I just recently started learning Django and have not yet fully understood the processing logic.

My html template:

{% for stream_name in stream_names %}
    <h2>{{ stream_name }}</h2>
    <img src="{% url 'video_stream' %}?stream_index={{ forloop.counter0 }}" style="width: 100%;">
    <hr>
{% endfor %}