Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,9 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
import numpy as np
|
| 3 |
import cv2
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
title = st.title("Welcome to Therapute")
|
| 6 |
|
|
@@ -19,15 +22,27 @@ st.success("Success")
|
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
import numpy as np
|
| 3 |
import cv2
|
| 4 |
+
import av
|
| 5 |
+
import mediapipe as mp
|
| 6 |
+
from streamlit_webrtc import webrtc_streamer, WebRtcMode, RTCConfiguration
|
| 7 |
|
| 8 |
title = st.title("Welcome to Therapute")
|
| 9 |
|
|
|
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
+
RTC_CONFIGURATION = RTCConfiguration(
|
| 26 |
+
{"iceServers": [{"urls": ["stun:stun.l.google.com:19302"]}]}
|
| 27 |
+
)
|
| 28 |
+
webrtc_ctx = webrtc_streamer(
|
| 29 |
+
key="TEST",
|
| 30 |
+
mode=WebRtcMode.SENDRECV,
|
| 31 |
+
rtc_configuration=RTC_CONFIGURATION,
|
| 32 |
+
media_stream_constraints={"video": True, "audio": False},
|
| 33 |
+
async_processing=True,
|
| 34 |
+
)
|
| 35 |
+
|
| 36 |
+
class VideoProcessor:
|
| 37 |
+
def recv(self, frame):
|
| 38 |
+
img = frame.to_ndarray(format="bgr24")
|
| 39 |
+
# img = process(img)
|
| 40 |
+
return av.VideoFrame.from_ndarray(img, format="bgr24")
|
| 41 |
+
webrtc_ctx = webrtc_streamer(
|
| 42 |
+
key="WYH",
|
| 43 |
+
mode=WebRtcMode.SENDRECV,
|
| 44 |
+
rtc_configuration=RTC_CONFIGURATION,
|
| 45 |
+
media_stream_constraints={"video": True, "audio": False},
|
| 46 |
+
video_processor_factory=VideoProcessor,
|
| 47 |
+
async_processing=True,
|
| 48 |
+
)
|