Skip to content

Conversation

@LiteObject
Copy link
Owner

No description provided.

LiteObject added 12 commits July 5, 2025 22:40
- 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.
…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
@LiteObject LiteObject requested a review from Copilot July 7, 2025 03:31
Copilot

This comment was marked as outdated.

…g and error handling. Update YOLOv8 model initialization for singleton pattern and improve UI dashboard metrics display.
@LiteObject LiteObject requested a review from Copilot July 11, 2025 03:38
Copy link

Copilot AI left a 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


# Auto-refresh
if st.session_state.auto_refresh:
time.sleep(2)
Copy link

Copilot AI Jul 11, 2025

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.

Suggested change
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...")

Copilot uses AI. Check for mistakes.
try:
# Create CastInfo for the known device
services = {HostServiceInfo(device_ip, port)}
services: Set[Union[HostServiceInfo, 'MDNSServiceInfo']] = {
Copy link

Copilot AI Jul 11, 2025

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.

Suggested change
services: Set[Union[HostServiceInfo, 'MDNSServiceInfo']] = {
services: Set[Union[HostServiceInfo, MDNSServiceInfo]] = {

Copilot uses AI. Check for mistakes.
if model_path not in cls._instances:
with cls._lock:
if model_path not in cls._instances:
instance = super().__new__(cls)
Copy link

Copilot AI Jul 11, 2025

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.

Suggested change
instance = super().__new__(cls)
instance = super().__new__(cls)
instance._model = YOLO(model_path) # Initialize the model here

Copilot uses AI. Check for mistakes.
return False
finally:
# Explicit frame cleanup to free memory
del frame
Copy link

Copilot AI Jul 11, 2025

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.

Suggested change
del frame
if 'frame' in locals() and frame is not None:
del frame

Copilot uses AI. Check for mistakes.
Comment on lines +46 to 48
- `streamlit` - Real-time web dashboard with live event updates
- `streamlit` - Real-time web dashboard (optional UI)

Copy link

Copilot AI Jul 11, 2025

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)'.

Suggested change
- `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)

Copilot uses AI. Check for mistakes.
…nhance logging and background service status checks.
…nhance logging and background service status checks.
…event-driven UI updates and performance optimizations.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant