Skip to content

Feature/add UI - #3

Open
LiteObject wants to merge 17 commits into
masterfrom
feature/add-ui
Open

Feature/add UI#3
LiteObject wants to merge 17 commits into
masterfrom
feature/add-ui

Conversation

@LiteObject

Copy link
Copy Markdown
Owner

No description provided.

- 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 CopilotJuly 7, 2025 03:31

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 CopilotJuly 11, 2025 03:38

CopilotAI left a comment

Copy link
Copy Markdown

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
FileDescription
src/ui_dashboard.pyNew Streamlit dashboard with real-time monitoring features and event display
src/event_broadcaster.pyNew event broadcasting system for cross-process communication and persistence
src/services.pyEnhanced with event emission and cleanup methods for broadcaster integration
src/google_broadcast.pyRefactored to support async operations with proper zeroconf handling
src/app.pyExtended with UI launcher options and graceful shutdown handling
src/notification_dispatcher.pyAdded context manager support and improved cleanup
run_ui.pyNew standalone entry point for UI dashboard
README.mdUpdated documentation with new UI features and troubleshooting

Comment threadsrc/ui_dashboard.py Outdated

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

CopilotAIJul 11, 2025

Copy link

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_inrange(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.
Comment threadsrc/google_broadcast.py Outdated
try:
# Create CastInfo for the known device
services = {HostServiceInfo(device_ip, port)}
services: Set[Union[HostServiceInfo, 'MDNSServiceInfo']] = {

CopilotAIJul 11, 2025

Copy link

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

CopilotAIJul 11, 2025

Copy link

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.
Comment threadsrc/services.py
return False
finally:
# Explicit frame cleanup to free memory
del frame

CopilotAIJul 11, 2025

Copy link

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
delframe
if'frame'inlocals() andframeisnotNone:
delframe

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

CopilotAIJul 11, 2025

Copy link

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 freeto 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.

2 participants

@LiteObject