Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,4 +1,25 @@
|
|
| 1 |
import streamlit as st
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
-
|
| 4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
+
from streamlit_webrtc import webrtc_streamer, VideoTransformerBase
|
| 3 |
+
import av
|
| 4 |
+
import cv2
|
| 5 |
|
| 6 |
+
st.title("KAISA APP HAI YEH BSDK")
|
| 7 |
+
|
| 8 |
+
# RTC Configuration for the video stream
|
| 9 |
+
RTC_CONFIGURATION = RTCConfiguration({"iceServers": [{"urls": ["stun:stun.l.google.com:19302"]}]})
|
| 10 |
+
|
| 11 |
+
# Function to process each video frame
|
| 12 |
+
|
| 13 |
+
class VideoTransforms(VideoTransformerBase):
|
| 14 |
+
def transform(self,frame):
|
| 15 |
+
img = frame.to_ndarray(format="bgr24")
|
| 16 |
+
# (Optional) Process the frame (e.g., apply filters)
|
| 17 |
+
img=cv2.flip(img,1)
|
| 18 |
+
# Return the processed frame
|
| 19 |
+
return img
|
| 20 |
+
|
| 21 |
+
# WebRTC streamer component
|
| 22 |
+
webrtc_streamer(
|
| 23 |
+
key="example",
|
| 24 |
+
video_transformer_factory=VideoTransforms,
|
| 25 |
+
)
|