# rishi18360/echo architecture

> Architecture diagram of the GitHub repository rishi18360/echo, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-07-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rishi18360/echo
- Repository: https://github.com/rishi18360/echo

## Overview

#### Purpose and Entry Points
ECHO is a Python 3.10 webcam-driven, single-hand gesture application. It recognizes raised-finger counts to select an interaction mode, then delegates gesture handling to that mode. The runtime entry point is `main.py`; GUI/display integration is likely separated in `app_gui.py`.

#### Application Orchestration
`main.py` is the top-level control loop: initialize camera/gesture processing, detect a mode-selection gesture, and run the active mode until switching or exit. It is the primary boundary between shared recognition/input infrastructure and mode-specific behavior.
- `main.py`
- `app_gui.py`

#### Gesture-Based Mode Selection
The initial routing mechanism maps finger counts to four domains: one finger for assistive, two for presentation, three for communication, and four for entertainment. Recognition is constrained to one hand and depends on webcam lighting/input quality. Keyboard input currently controls mode switching, making keyboard events a parallel control path to gestures.
- `main.py`
- `modes/__init__.py`

#### Mode Package Boundary
The `modes` package isolates user-facing capabilities from the main runtime. Each module should own its gesture interpretation, on-screen instructions, and action execution after activation. This modular split allows modes to evolve without changing the mode-selection loop.
- `modes/__init__.py`
- `modes/assistive.py`
- `modes/presentation.py`

#### Assistive and Communication Domains
Assistive behavior is implemented independently from communication behavior, indicating separate action vocabularies and potentially different downstream OS or messaging interactions. These are invoked only after the shared selector has chosen their mode.
- `modes/assistive.py`
- `modes/communication.py`

#### Presentation and Entertainment Domains
Presentation mode handles gesture-controlled presentation interactions, while entertainment mode contains leisure/media-oriented interactions. Both consume the same high-level webcam/gesture session but remain isolated modules.
- `modes/presentation.py`
- `modes/entertainment.py`

#### Runtime and Dependencies
The application is a local Python desktop process, launched with `python main.py` and tested against Python 3.10.x. Required computer-vision, GUI, and any device/action libraries are declared centrally in `requirements.txt`. Its key external boundary is the local webcam; on-screen feedback is part of the local GUI path rather than a web or server deployment.
- `requirements.txt`
- `main.py`
- `app_gui.py`

Main entry points: [`modes/__init__.py`](https://github.com/rishi18360/echo/blob/main/modes/__init__.py) (Mode Interface), [`main.py`](https://github.com/rishi18360/echo/blob/main/main.py) (Control Loop), [`app_gui.py`](https://github.com/rishi18360/echo/blob/main/app_gui.py) (Display Feedback), [`modes/assistive.py`](https://github.com/rishi18360/echo/blob/main/modes/assistive.py) (Assistive Mode)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Desktop Runtime"]
  node_dependencies["Dependencies<br/>Python requirements<br/>[requirements.txt]"]
  node_main["Control Loop<br/>Python entry point<br/>[main.py]"]
  node_webcam{{"Local Webcam<br/>device input"}}
  node_gesture_selector["Finger Count Selector<br/>gesture routing<br/>[main.py]"]
  node_keyboard["Keyboard Controls<br/>parallel control input<br/>[main.py]"]
  node_gui["Display Feedback<br/>desktop GUI<br/>[app_gui.py]"]
end

subgraph group_modes["Interaction Modes"]
  node_mode_package["Mode Interface<br/>Python package<br/>[__init__.py]"]
  node_assistive["Assistive Mode<br/>mode handler<br/>[assistive.py]"]
  node_presentation["Presentation Mode<br/>mode handler<br/>[presentation.py]"]
  node_communication["Communication Mode<br/>mode handler<br/>[communication.py]"]
  node_entertainment["Entertainment Mode<br/>mode handler<br/>[entertainment.py]"]
end

node_dependencies -.->|"provides runtime libraries"| node_main
node_webcam -->|"video input"| node_main
node_main -->|"detects raised fingers"| node_gesture_selector
node_keyboard -->|"switch or exit events"| node_main
node_main -->|"renders feedback"| node_gui
node_gesture_selector -->|"activates selected mode"| node_mode_package
node_mode_package -->|"1 finger"| node_assistive
node_mode_package -->|"2 fingers"| node_presentation
node_mode_package -->|"3 fingers"| node_communication
node_mode_package -->|"4 fingers"| node_entertainment
node_assistive -->|"instructions and feedback"| node_gui
node_presentation -->|"instructions and feedback"| node_gui
node_communication -->|"instructions and feedback"| node_gui
node_entertainment -->|"instructions and feedback"| node_gui

click node_dependencies "https://github.com/rishi18360/echo/blob/main/requirements.txt"
click node_main "https://github.com/rishi18360/echo/blob/main/main.py"
click node_gesture_selector "https://github.com/rishi18360/echo/blob/main/main.py"
click node_keyboard "https://github.com/rishi18360/echo/blob/main/main.py"
click node_gui "https://github.com/rishi18360/echo/blob/main/app_gui.py"
click node_mode_package "https://github.com/rishi18360/echo/blob/main/modes/__init__.py"
click node_assistive "https://github.com/rishi18360/echo/blob/main/modes/assistive.py"
click node_presentation "https://github.com/rishi18360/echo/blob/main/modes/presentation.py"
click node_communication "https://github.com/rishi18360/echo/blob/main/modes/communication.py"
click node_entertainment "https://github.com/rishi18360/echo/blob/main/modes/entertainment.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_dependencies,node_main,node_webcam,node_gesture_selector,node_keyboard,node_gui toneBlue
class node_mode_package,node_assistive,node_presentation,node_communication,node_entertainment toneAmber
```

## Components

### Desktop Runtime

- [Dependencies](https://github.com/rishi18360/echo/blob/main/requirements.txt): Python requirements · CV, GUI, and device/action libraries. · `requirements.txt`
- [Control Loop](https://github.com/rishi18360/echo/blob/main/main.py): Python entry point · Initializes input, selects modes, and manages switching or exit. · `main.py`
- **Local Webcam**: device input · Single-hand gesture input; sensitive to lighting and camera quality.
- [Finger Count Selector](https://github.com/rishi18360/echo/blob/main/main.py): gesture routing · Maps one through four raised fingers to active modes. · `main.py`
- [Keyboard Controls](https://github.com/rishi18360/echo/blob/main/main.py): parallel control input · Controls mode switching alongside gestures. · `main.py`
- [Display Feedback](https://github.com/rishi18360/echo/blob/main/app_gui.py): desktop GUI · Provides local on-screen feedback and instructions. · `app_gui.py`

### Interaction Modes

- [Mode Interface](https://github.com/rishi18360/echo/blob/main/modes/__init__.py): Python package · Boundary between selection and mode-specific gesture behavior. · `modes/__init__.py`
- [Assistive Mode](https://github.com/rishi18360/echo/blob/main/modes/assistive.py): mode handler · Handles assistive action gestures. · `modes/assistive.py`
- [Presentation Mode](https://github.com/rishi18360/echo/blob/main/modes/presentation.py): mode handler · Handles presentation-control gestures. · `modes/presentation.py`
- [Communication Mode](https://github.com/rishi18360/echo/blob/main/modes/communication.py): mode handler · Handles communication-specific gestures. · `modes/communication.py`
- [Entertainment Mode](https://github.com/rishi18360/echo/blob/main/modes/entertainment.py): mode handler · Handles leisure or media gestures. · `modes/entertainment.py`

## Connections

- Dependencies → Control Loop: provides runtime libraries
- Local Webcam → Control Loop: video input
- Control Loop → Finger Count Selector: detects raised fingers
- Keyboard Controls → Control Loop: switch or exit events
- Control Loop → Display Feedback: renders feedback
- Finger Count Selector → Mode Interface: activates selected mode
- Mode Interface → Assistive Mode: 1 finger
- Mode Interface → Presentation Mode: 2 fingers
- Mode Interface → Communication Mode: 3 fingers
- Mode Interface → Entertainment Mode: 4 fingers
- Assistive Mode → Display Feedback: instructions and feedback
- Presentation Mode → Display Feedback: instructions and feedback
- Communication Mode → Display Feedback: instructions and feedback
- Entertainment Mode → Display Feedback: instructions and feedback
