Video AI Analysis Tool uses a multi-process architecture designed for scalability, reliability, and optimal GPU utilization. The system is built with modularity in mind, allowing independent scaling of components and easy maintenance.
Video AI is a multi-process application designed for analyzing images and videos using AI models. The system supports both CUDA and ROCm backends for GPU acceleration.
## System Components
## Components
### 1. Web Interface Process (`vidai/web.py`)
### 1. Web Interface Process (`vidai/web.py`)
- Flask-based web server
**Purpose**: Handles user interactions and serves the web application.
- Serves the user interface
- Sends requests to backend via TCP socket (port 5001)
**Responsibilities**:
- Polls for results via temporary JSON files
- User authentication and session management
- File upload handling and validation
- Job submission to backend
- Result display and user interface
- API endpoint serving
**Technology**: Flask web framework with custom authentication decorators.
**Communication**: Connects to backend via TCP sockets on port 5001.
### 2. Backend Process (`vidai/backend.py`)
### 2. Backend Process (`vidai/backend.py`)
- Central message router
**Purpose**: Central routing and coordination hub.
- Listens for web requests on port 5001
- Listens for worker connections on port 5002
**Responsibilities**:
- Routes requests to appropriate workers based on configuration
- Request validation and preprocessing
- Handles configuration updates
- Load balancing across worker processes
- Configuration management and updates
- Result aggregation and caching
- Health monitoring of worker processes
**Technology**: Custom socket server with message routing logic.
**Communication**:
- Receives requests from web interface on port 5001