# nadir199/pygesture-side-project-pytorch-scholarship-challenge architecture

> Architecture diagram of the GitHub repository nadir199/pygesture-side-project-pytorch-scholarship-challenge, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nadir199/pygesture-side-project-pytorch-scholarship-challenge
- Repository: https://github.com/nadir199/pygesture-side-project-pytorch-scholarship-challenge

## Overview

##### Main Components

a) Frontend Layer:
- Sub-components for:
- Templates (home.html, settings.html, layout.html)
- Static assets (CSS, JS, bootstrap files)

b) Backend Layer:
- Flask Server component (index.py)
- Gesture Recognition Engine (program.py)
- Neural Network Model (net.pt)
- Settings Manager (settings.json)

c) Hardware Integration:
- Webcam Input component
- System Output (keyboard/browser actions)

##### Component Relationships

- User → Web Interface → Flask Server → Settings Manager (configuration flow)
- Webcam → Gesture Recognition Engine → Neural Network Model → System Actions (runtime flow)

##### Specific Implementation Details

A) Configuration Flow:
**[Web Browser] → [Flask Server (index.py)]**
- ↓
- [Settings Manager]
- (settings.json)

B) Runtime Flow:
**[Webcam] → [Gesture Recognition (program.py)] → [PyTorch Model (net.pt)]**
- ↓
- [Action Executor]
- ↓
- [System Actions (keyboard/browser)]

##### Important Notes

- A clear distinction between the configuration phase (web interface) and the runtime phase (gesture recognition)
- Two main gesture types (Fist, High five) and three action types (website, key press, phrase typing)
- Technology stack: Flask, PyTorch, OpenCV
- HTTP server port (5000) for the web interface

##### Additional Elements

- Data flow directions
- Component types
- Configuration vs Runtime modes
- Input/Output interfaces

##### Runtime workflow through the gesture recognition system

This will help other developers understand both how to configure the system and how it operates during runtime.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Frontend Layer"
        WEB["Web Configuration Interface"]
        TEMP["Templates"]
        STATIC["Static Assets"]
    end

    subgraph "Backend Layer"
        FLASK["Flask Server"]
        GESTURE["Gesture Recognition Engine"]
        NN["Neural Network Model"]
        SETTINGS["Settings Manager"]
    end

    subgraph "Hardware Layer"
        WEBCAM["Webcam Input"]:::hardware
        SYSOUT["System Output"]:::hardware
    end

    %% Configuration Flow
    WEB --> FLASK
    FLASK --> SETTINGS
    SETTINGS --> GESTURE

    %% Runtime Flow
    WEBCAM --> GESTURE
    GESTURE --> NN
    NN --> SYSOUT

    %% Component Details
    TEMP --> |"home.html"| WEB
    TEMP --> |"settings.html"| WEB
    TEMP --> |"layout.html"| WEB
    STATIC --> |"CSS/JS"| WEB

    %% Click Events
    click WEB "https://github.com/nadir199/PyGesture-Side-project-Pytorch-Scholarship-Challenge/tree/master/templates"
    click TEMP "https://github.com/nadir199/PyGesture-Side-project-Pytorch-Scholarship-Challenge/tree/master/templates"
    click STATIC "https://github.com/nadir199/PyGesture-Side-project-Pytorch-Scholarship-Challenge/tree/master/static"
    click FLASK "https://github.com/nadir199/PyGesture-Side-project-Pytorch-Scholarship-Challenge/blob/master/index.py"
    click GESTURE "https://github.com/nadir199/PyGesture-Side-project-Pytorch-Scholarship-Challenge/blob/master/program.py"
    click NN "https://github.com/nadir199/PyGesture-Side-project-Pytorch-Scholarship-Challenge/blob/master/net.pt"
    click SETTINGS "https://github.com/nadir199/PyGesture-Side-project-Pytorch-Scholarship-Challenge/blob/master/settings.json"

    %% Styling
    classDef default fill:#f9f9f9,stroke:#333,stroke-width:2px
    classDef frontend fill:#ddf1fd,stroke:#0077b6
    classDef backend fill:#d1ffd7,stroke:#087f23
    classDef hardware fill:#ffe0e0,stroke:#c62828
    classDef data fill:#fff3cd,stroke:#856404

    class WEB,TEMP,STATIC frontend
    class FLASK,GESTURE backend
    class NN,SETTINGS data
    class WEBCAM,SYSOUT hardware

    %% Legend
    subgraph Legend
        L1[Frontend Components]:::frontend
        L2[Backend Services]:::backend
        L3[Data Storage]:::data
        L4[Hardware Interface]:::hardware
    end
```
