Spaces:
Build error
Build error
Regino
commited on
Commit
·
60845fc
1
Parent(s):
a876981
fs
Browse files- src/streamlit_app.py +12 -9
- train.ipynb +0 -0
src/streamlit_app.py
CHANGED
|
@@ -134,6 +134,10 @@ class EmotionDetector(VideoTransformerBase):
|
|
| 134 |
# Convert the processed BGR image back to RGB for Streamlit/WebRTC display
|
| 135 |
return cv2.cvtColor(img_bgr, cv2.COLOR_BGR2RGB)
|
| 136 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 137 |
# --- 4. Streamlit App Layout and WebRTC Stream ---
|
| 138 |
st.title("Live Facial Emotion Recognition")
|
| 139 |
|
|
@@ -150,16 +154,13 @@ webrtc_ctx = webrtc_streamer(
|
|
| 150 |
video_processor_factory=lambda: EmotionDetector(model, face_detector),
|
| 151 |
media_stream_constraints={"video": True, "audio": False}, # Only video, no audio
|
| 152 |
|
| 153 |
-
#
|
| 154 |
-
# If this works, it points to an asyncio interaction issue. For better performance,
|
| 155 |
-
# you'd ideally re-enable async_processing=True later.
|
| 156 |
-
async_processing=False,
|
| 157 |
|
| 158 |
# Optional: tries to auto-start. Can comment out if you prefer manual start.
|
| 159 |
# desired_playing_state={"playing": True},
|
| 160 |
|
| 161 |
# --- ENHANCED RTC CONFIGURATION ---
|
| 162 |
-
# Providing a robust list of public STUN servers for better NAT traversal
|
| 163 |
rtc_configuration={
|
| 164 |
"iceServers": [
|
| 165 |
{"urls": ["stun:stun.l.google.com:19302"]},
|
|
@@ -169,12 +170,14 @@ webrtc_ctx = webrtc_streamer(
|
|
| 169 |
{"urls": ["stun:stun4.l.google.com:19302"]},
|
| 170 |
{"urls": ["stun:stun.services.mozilla.com"]},
|
| 171 |
{"urls": ["stun:global.stun.twilio.com:3478"]},
|
| 172 |
-
{"urls": ["stun:stun.nextcloud.com:3478"]},
|
| 173 |
-
{"urls": ["stun:stun.schlund.de"]},
|
|
|
|
|
|
|
| 174 |
]
|
| 175 |
},
|
| 176 |
-
#
|
| 177 |
-
|
| 178 |
)
|
| 179 |
|
| 180 |
# Provide feedback based on the stream state
|
|
|
|
| 134 |
# Convert the processed BGR image back to RGB for Streamlit/WebRTC display
|
| 135 |
return cv2.cvtColor(img_bgr, cv2.COLOR_BGR2RGB)
|
| 136 |
|
| 137 |
+
# app.py
|
| 138 |
+
|
| 139 |
+
# ... (previous code above) ...
|
| 140 |
+
|
| 141 |
# --- 4. Streamlit App Layout and WebRTC Stream ---
|
| 142 |
st.title("Live Facial Emotion Recognition")
|
| 143 |
|
|
|
|
| 154 |
video_processor_factory=lambda: EmotionDetector(model, face_detector),
|
| 155 |
media_stream_constraints={"video": True, "audio": False}, # Only video, no audio
|
| 156 |
|
| 157 |
+
async_processing=False, # Keep this False for now to avoid asyncio errors
|
|
|
|
|
|
|
|
|
|
| 158 |
|
| 159 |
# Optional: tries to auto-start. Can comment out if you prefer manual start.
|
| 160 |
# desired_playing_state={"playing": True},
|
| 161 |
|
| 162 |
# --- ENHANCED RTC CONFIGURATION ---
|
| 163 |
+
# Providing a very robust list of public STUN servers for better NAT traversal
|
| 164 |
rtc_configuration={
|
| 165 |
"iceServers": [
|
| 166 |
{"urls": ["stun:stun.l.google.com:19302"]},
|
|
|
|
| 170 |
{"urls": ["stun:stun4.l.google.com:19302"]},
|
| 171 |
{"urls": ["stun:stun.services.mozilla.com"]},
|
| 172 |
{"urls": ["stun:global.stun.twilio.com:3478"]},
|
| 173 |
+
{"urls": ["stun:stun.nextcloud.com:3478"]},
|
| 174 |
+
{"urls": ["stun:stun.schlund.de"]},
|
| 175 |
+
{"urls": ["stun:stun.stunprotocol.org"]}, # Added another
|
| 176 |
+
{"urls": ["stun:stunserver.org"]}, # Added another
|
| 177 |
]
|
| 178 |
},
|
| 179 |
+
# --- Enable Debug Logging ---
|
| 180 |
+
log_level="debug", # <--- CRITICAL FOR DIAGNOSIS
|
| 181 |
)
|
| 182 |
|
| 183 |
# Provide feedback based on the stream state
|
train.ipynb
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|