Conversation
- Introduced a Streamlit-based UI dashboard for monitoring RTSP processing. - Implemented an event broadcasting system for real-time updates. - Updated main application to support launching with a UI option. - Enhanced README and requirements to include Streamlit and related instructions. - Added tests for UI imports to ensure functionality without Streamlit installed.
… display with friendly timestamps
…atting, argument parsing, and UI imports
…e; improve event broadcasting with deque for memory efficiency; add context manager for notification dispatcher cleanup.
…s; update device discovery and message sending methods for improved performance and reliability.
…ing and saving of events to a JSON file for improved data retention and recovery.
…nhance logging and background service status checks.
…c context; implement thread handling to avoid event loop errors.
…shboard features, troubleshooting, and updated dependencies
…g and Google Hub broadcasting
…g and error handling. Update YOLOv8 model initialization for singleton pattern and improve UI dashboard metrics display.
There was a problem hiding this comment.
Pull Request Overview
This PR adds a comprehensive Streamlit UI dashboard for real-time monitoring of the RTSP processing system. The changes include creating a web-based interface with live event streaming, metrics tracking, and enhanced async support for Google Hub broadcasts, along with a sophisticated event broadcasting system for cross-process communication.
- Implements a real-time web dashboard with live metrics, image gallery, and event streaming
- Adds cross-process event broadcasting system using persistent JSON storage for UI updates
- Enhances async support in Google Hub communication with better error handling and timeout management
Reviewed Changes
Copilot reviewed 10 out of 13 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/ui_dashboard.py | New Streamlit dashboard with real-time monitoring features and event display |
| src/event_broadcaster.py | New event broadcasting system for cross-process communication and persistence |
| src/services.py | Enhanced with event emission and cleanup methods for broadcaster integration |
| src/google_broadcast.py | Refactored to support async operations with proper zeroconf handling |
| src/app.py | Extended with UI launcher options and graceful shutdown handling |
| src/notification_dispatcher.py | Added context manager support and improved cleanup |
| run_ui.py | New standalone entry point for UI dashboard |
| README.md | Updated documentation with new UI features and troubleshooting |
src/ui_dashboard.py
Outdated
|
|
||
| # Auto-refresh | ||
| if st.session_state.auto_refresh: | ||
| time.sleep(2) |
There was a problem hiding this comment.
Using time.sleep() in a Streamlit app can block the UI thread. Consider using st.empty() with a placeholder and manual refresh triggers instead of blocking sleep.
| time.sleep(2) | |
| placeholder = st.empty() | |
| for _ in range(20): # Adjust the range for a 2-second delay (20 iterations of 0.1s) | |
| time.sleep(0.1) | |
| placeholder.text("Refreshing...") |
src/google_broadcast.py
Outdated
| try: | ||
| # Create CastInfo for the known device | ||
| services = {HostServiceInfo(device_ip, port)} | ||
| services: Set[Union[HostServiceInfo, 'MDNSServiceInfo']] = { |
There was a problem hiding this comment.
Using forward reference string 'MDNSServiceInfo' suggests this type may not be properly imported. Consider importing the actual type or removing it from the type hint if not needed.
| services: Set[Union[HostServiceInfo, 'MDNSServiceInfo']] = { | |
| services: Set[Union[HostServiceInfo, MDNSServiceInfo]] = { |
| @@ -32,7 +36,6 @@ def __new__(cls, model_path='yolov8n.pt'): | |||
| with cls._lock: | |||
| if model_path not in cls._instances: | |||
| instance = super().__new__(cls) | |||
There was a problem hiding this comment.
The model initialization has been moved to init but the singleton pattern still creates the instance in new. This creates a race condition where _model might not be initialized when the instance is returned.
| instance = super().__new__(cls) | |
| instance = super().__new__(cls) | |
| instance._model = YOLO(model_path) # Initialize the model here |
| return False | ||
| finally: | ||
| # Explicit frame cleanup to free memory | ||
| del frame |
There was a problem hiding this comment.
Explicit del frame in finally block may cause issues if frame was not successfully created due to exceptions in earlier code. Consider checking if frame exists before deletion.
| del frame | |
| if 'frame' in locals() and frame is not None: | |
| del frame |
| - `streamlit` - Real-time web dashboard with live event updates | ||
| - `streamlit` - Real-time web dashboard (optional UI) | ||
|
|
There was a problem hiding this comment.
Duplicate streamlit entry in the dependencies list. One line says 'with live event updates' and the next says '(optional UI)'.
| - `streamlit` - Real-time web dashboard with live event updates | |
| - `streamlit` - Real-time web dashboard (optional UI) | |
| - `streamlit` - Real-time web dashboard with live event updates (optional UI) |
…nhance logging and background service status checks.
…enhance documentation for clarity.
…nhance logging and background service status checks.
…event-driven UI updates and performance optimizations.
No description provided.