-
Couldn't load subscription status.
- Fork 0
Feature/add UI #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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) |
Copilot
AI
Jul 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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']] = { |
Copilot
AI
Jul 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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]] = { |
| if model_path not in cls._instances: | ||
| with cls._lock: | ||
| if model_path not in cls._instances: | ||
| instance = super().__new__(cls) |
Copilot
AI
Jul 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
Copilot
AI
Jul 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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) | ||
|
|
Copilot
AI
Jul 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.