# nitesh-0/times-net architecture

> Architecture diagram of the GitHub repository nitesh-0/times-net, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nitesh-0/times-net
- Repository: https://github.com/nitesh-0/times-net

## Overview

This repository implements a RetNet video action-recognition demo: a user uploads a video, selects a dataset and inference mode, and views predictions and performance metrics. The Streamlit frontend sends parallel requests or consumes a streaming response from a Modal-hosted FastAPI backend. Backend excerpts show video extraction and preprocessing, model-related components, and parallel/streaming inference helpers, but omit much of the routing and inference implementation; dashed, uncited edges mark those unverified connections.

Main entry points: [`backend/modal_app.py`](https://github.com/nitesh-0/times-net/blob/master/backend/modal_app.py) (Parallel endpoint), [`frontend/app.py`](https://github.com/nitesh-0/times-net/blob/master/frontend/app.py) (Parallel client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Demo frontend"]
  node_controls["Mode and dataset<br/>[app.py]"]
  node_upload["Video upload<br/>[app.py]"]
  node_parallel_client["Parallel client<br/>[app.py]"]
  node_stream_client["Streaming client<br/>[app.py]"]
  node_results["Predictions and metrics<br/>[app.py]"]
end

subgraph group_api["Backend API"]
  node_parallel_route["Parallel endpoint<br/>[modal_app.py]"]
  node_stream_route["Streaming endpoint<br/>[modal_app.py]"]
  node_frame_extract["Frame extraction<br/>[modal_app.py]"]
  node_preprocess["Frame preprocessing<br/>[modal_app.py]"]
end

subgraph group_inference["Inference runtime"]
  node_model_setup["Model components<br/>[modal_app.py]"]
  node_parallel_infer["Parallel inference<br/>[modal_app.py]"]
  node_stream_infer["Streaming inference<br/>[modal_app.py]"]
end

node_user(("Video user"))

node_user -->|"uploads video"| node_upload
node_user -->|"selects mode"| node_controls
node_upload -->|"submits video"| node_parallel_client
node_controls -->|"selects request"| node_parallel_client
node_parallel_client -->|"posts video"| node_parallel_route
node_upload -->|"submits video"| node_stream_client
node_controls -->|"selects request"| node_stream_client
node_stream_client -->|"streams response"| node_stream_route
node_parallel_route -->|"extracts frames"| node_frame_extract
node_parallel_route -->|"preprocesses frames"| node_preprocess
node_stream_route -->|"extracts frames"| node_frame_extract
node_parallel_route -.->|"runs inference"| node_parallel_infer
node_stream_route -.->|"runs inference"| node_stream_infer
node_parallel_infer -.->|"uses models"| node_model_setup
node_stream_infer -.->|"uses models"| node_model_setup
node_parallel_client -->|"renders results"| node_results
node_stream_client -->|"renders updates"| node_results

click node_controls "https://github.com/nitesh-0/times-net/blob/master/frontend/app.py"
click node_upload "https://github.com/nitesh-0/times-net/blob/master/frontend/app.py"
click node_parallel_client "https://github.com/nitesh-0/times-net/blob/master/frontend/app.py"
click node_stream_client "https://github.com/nitesh-0/times-net/blob/master/frontend/app.py"
click node_results "https://github.com/nitesh-0/times-net/blob/master/frontend/app.py"
click node_parallel_route "https://github.com/nitesh-0/times-net/blob/master/backend/modal_app.py"
click node_stream_route "https://github.com/nitesh-0/times-net/blob/master/backend/modal_app.py"
click node_frame_extract "https://github.com/nitesh-0/times-net/blob/master/backend/modal_app.py"
click node_preprocess "https://github.com/nitesh-0/times-net/blob/master/backend/modal_app.py"
click node_model_setup "https://github.com/nitesh-0/times-net/blob/master/backend/modal_app.py"
click node_parallel_infer "https://github.com/nitesh-0/times-net/blob/master/backend/modal_app.py"
click node_stream_infer "https://github.com/nitesh-0/times-net/blob/master/backend/modal_app.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_controls,node_upload,node_parallel_client,node_stream_client,node_results,node_user toneBlue
class node_parallel_route,node_stream_route,node_frame_extract,node_preprocess toneAmber
class node_model_setup,node_parallel_infer,node_stream_infer toneMint
```

## Components

### Demo frontend

- [Mode and dataset](https://github.com/nitesh-0/times-net/blob/master/frontend/app.py): `frontend/app.py`
- [Video upload](https://github.com/nitesh-0/times-net/blob/master/frontend/app.py): `frontend/app.py`
- [Parallel client](https://github.com/nitesh-0/times-net/blob/master/frontend/app.py): `frontend/app.py`
- [Streaming client](https://github.com/nitesh-0/times-net/blob/master/frontend/app.py): `frontend/app.py`
- [Predictions and metrics](https://github.com/nitesh-0/times-net/blob/master/frontend/app.py): `frontend/app.py`

### Backend API

- [Parallel endpoint](https://github.com/nitesh-0/times-net/blob/master/backend/modal_app.py): `backend/modal_app.py`
- [Streaming endpoint](https://github.com/nitesh-0/times-net/blob/master/backend/modal_app.py): `backend/modal_app.py`
- [Frame extraction](https://github.com/nitesh-0/times-net/blob/master/backend/modal_app.py): `backend/modal_app.py`
- [Frame preprocessing](https://github.com/nitesh-0/times-net/blob/master/backend/modal_app.py): `backend/modal_app.py`

### Inference runtime

- [Model components](https://github.com/nitesh-0/times-net/blob/master/backend/modal_app.py): `backend/modal_app.py`
- [Parallel inference](https://github.com/nitesh-0/times-net/blob/master/backend/modal_app.py): `backend/modal_app.py`
- [Streaming inference](https://github.com/nitesh-0/times-net/blob/master/backend/modal_app.py): `backend/modal_app.py`

### Other components

- **Video user**

## Connections

- Video user → Video upload: uploads video (evidence: `frontend/app.py`)
- Video user → Mode and dataset: selects mode (evidence: `frontend/app.py`)
- Video upload → Parallel client: submits video (evidence: `frontend/app.py`)
- Mode and dataset → Parallel client: selects request (evidence: `frontend/app.py`)
- Parallel client → Parallel endpoint: posts video (evidence: `frontend/app.py`)
- Video upload → Streaming client: submits video (evidence: `frontend/app.py`)
- Mode and dataset → Streaming client: selects request (evidence: `frontend/app.py`)
- Streaming client → Streaming endpoint: streams response (evidence: `frontend/app.py`)
- Parallel endpoint → Frame extraction: extracts frames (evidence: `backend/modal_app.py`)
- Parallel endpoint → Frame preprocessing: preprocesses frames (evidence: `backend/modal_app.py`)
- Streaming endpoint → Frame extraction: extracts frames (evidence: `backend/modal_app.py`)
- Parallel endpoint → Parallel inference: runs inference (evidence: `backend/modal_app.py`)
- Streaming endpoint → Streaming inference: runs inference (evidence: `backend/modal_app.py`)
- Parallel inference → Model components: uses models (evidence: `backend/modal_app.py`)
- Streaming inference → Model components: uses models (evidence: `backend/modal_app.py`)
- Parallel client → Predictions and metrics: renders results (evidence: `frontend/app.py`)
- Streaming client → Predictions and metrics: renders updates (evidence: `frontend/app.py`)
