Spaces:
Runtime error
Runtime error
fouadmahmoud283-ai commited on
Commit ·
715ade4
1
Parent(s): 945aa5a
fixing camera n1235
Browse files- src/streamlit_app.py +9 -1
src/streamlit_app.py
CHANGED
|
@@ -524,6 +524,9 @@ def main():
|
|
| 524 |
st.markdown("### 📹 Realtime Camera Detection")
|
| 525 |
st.caption("Start the camera to run live detection on each frame.")
|
| 526 |
|
|
|
|
|
|
|
|
|
|
| 527 |
if st.session_state.model is None:
|
| 528 |
with st.spinner("🤖 Loading AI model..."):
|
| 529 |
st.session_state.model = load_model(conf_threshold)
|
|
@@ -532,7 +535,12 @@ def main():
|
|
| 532 |
key="realtime_camera",
|
| 533 |
video_processor_factory=lambda: RealtimeVideoProcessor(st.session_state.model, conf_threshold),
|
| 534 |
media_stream_constraints={"video": True, "audio": False},
|
| 535 |
-
async_processing=True
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 536 |
)
|
| 537 |
|
| 538 |
realtime_detections = None
|
|
|
|
| 524 |
st.markdown("### 📹 Realtime Camera Detection")
|
| 525 |
st.caption("Start the camera to run live detection on each frame.")
|
| 526 |
|
| 527 |
+
if 'model' not in st.session_state:
|
| 528 |
+
st.session_state.model = None
|
| 529 |
+
|
| 530 |
if st.session_state.model is None:
|
| 531 |
with st.spinner("🤖 Loading AI model..."):
|
| 532 |
st.session_state.model = load_model(conf_threshold)
|
|
|
|
| 535 |
key="realtime_camera",
|
| 536 |
video_processor_factory=lambda: RealtimeVideoProcessor(st.session_state.model, conf_threshold),
|
| 537 |
media_stream_constraints={"video": True, "audio": False},
|
| 538 |
+
async_processing=True,
|
| 539 |
+
rtc_configuration={
|
| 540 |
+
"iceServers": [
|
| 541 |
+
{"urls": ["stun:stun.l.google.com:19302", "stun:stun1.l.google.com:19302"]}
|
| 542 |
+
]
|
| 543 |
+
}
|
| 544 |
)
|
| 545 |
|
| 546 |
realtime_detections = None
|