Hi guys. I’m slowly starting to learn the framework and have written a simple application using mediapipe . But it slows down a lot tell me, please, what options to write in the right way and in which direction to read. Thank you very much
my super app :))
import streamlit as st
from streamlit_webrtc import webrtc_streamer
from cvzone.HandTrackingModule import HandDetector
import av
st.write("Hello, Men :)")
class VideoProcessor:
def recv(self, frame):
detector = HandDetector(maxHands=1, detectionCon=0.8)
img = frame.to_ndarray(format="bgr24")
hands, img = detector.findHands(img)
return av.VideoFrame.from_ndarray(img, format="bgr24")
ctx = webrtc_streamer(
key="example",
video_processor_factory=VideoProcessor,
media_stream_constraints={
"video": True,
"audio": False
}
)