# lukasmosser/seismic-arena architecture

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

- Interactive diagram: https://gitdiagram.com/lukasmosser/seismic-arena
- Repository: https://github.com/lukasmosser/seismic-arena

## Overview

Seismic Arena lets people compare seismic fault-segmentation models by viewing predictions for the same validation image and submitting a preference; battle outcomes feed an Elo-style leaderboard. The map separates the Gradio workflow, model inference, and rating service. The README documents Modal-hosted inference, persistence, and leaderboard behavior; sampled source confirms the key calls. Model architecture and rating calculation are represented as internal layers. The baseline notebooks and deployment workflows are outside the runtime map.

Main entry points: [`src/score_db.py`](https://github.com/lukasmosser/seismic-arena/blob/main/src/score_db.py) (Battle and ratings API), [`src/app.py`](https://github.com/lukasmosser/seismic-arena/blob/main/src/app.py) (Arena and UI), [`src/model_endpoints.py`](https://github.com/lukasmosser/seismic-arena/blob/main/src/model_endpoints.py) (GPU model runner), [`src/models/unet_model.py`](https://github.com/lukasmosser/seismic-arena/blob/main/src/models/unet_model.py) (Baseline model wrapper)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_arena["Arena interface"]
  node_gradio["Arena and UI<br/>[app.py]"]
  node_validation[("Validation images")]
  node_leaderboard["Leaderboard view<br/>[app.py]"]
end

subgraph group_inference["Model inference"]
  node_inference_api["Prediction endpoint<br/>[model_endpoints.py]"]
  node_model_runner["GPU model runner<br/>[model_endpoints.py]"]
  node_model_wrapper["Baseline model wrapper<br/>[unet_model.py]"]
end

subgraph group_ratings["Ratings service"]
  node_rating_api["Battle and ratings API<br/>[score_db.py]"]
  node_battle_store[("Battle volume<br/>[score_db.py]")]
end

subgraph group_internals["Internal layers"]
  node_unet["UNet architecture"]
  node_elo["Elo calculation<br/>[rating.py]"]
end

node_judge(("Human judge"))
node_dataset_service["Dataset host"]
node_model_hub["Model weight host"]

node_judge -->|"rates models"| node_gradio
node_gradio -->|"loads samples"| node_dataset_service
node_dataset_service -.->|"provides images"| node_validation
node_gradio -->|"requests predictions"| node_inference_api
node_inference_api -->|"dispatches inference"| node_model_runner
node_model_runner -->|"loads model"| node_model_wrapper
node_model_wrapper -->|"uses architecture"| node_unet
node_model_runner -.->|"loads weights"| node_model_hub
node_gradio -->|"submits battles"| node_rating_api
node_rating_api -->|"writes battles"| node_battle_store
node_rating_api -->|"reads battles"| node_battle_store
node_rating_api -->|"computes ratings"| node_elo
node_gradio -->|"opens leaderboard"| node_leaderboard
node_leaderboard -->|"fetches ratings"| node_rating_api
node_rating_api -->|"returns ratings"| node_leaderboard

click node_gradio "https://github.com/lukasmosser/seismic-arena/blob/main/src/app.py"
click node_inference_api "https://github.com/lukasmosser/seismic-arena/blob/main/src/model_endpoints.py"
click node_model_runner "https://github.com/lukasmosser/seismic-arena/blob/main/src/model_endpoints.py"
click node_model_wrapper "https://github.com/lukasmosser/seismic-arena/blob/main/src/models/unet_model.py"
click node_unet "https://github.com/lukasmosser/seismic-arena/blob/main/src/models/unet_model_dropout.py"
click node_rating_api "https://github.com/lukasmosser/seismic-arena/blob/main/src/score_db.py"
click node_battle_store "https://github.com/lukasmosser/seismic-arena/blob/main/src/score_db.py"
click node_elo "https://github.com/lukasmosser/seismic-arena/blob/main/src/rating.py"
click node_leaderboard "https://github.com/lukasmosser/seismic-arena/blob/main/src/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_gradio,node_validation,node_leaderboard toneBlue
class node_inference_api,node_model_runner,node_model_wrapper toneAmber
class node_rating_api,node_battle_store toneMint
class node_unet,node_elo toneRose
class node_judge,node_dataset_service,node_model_hub toneIndigo
```

## Components

### Arena interface

- [Arena and UI](https://github.com/lukasmosser/seismic-arena/blob/main/src/app.py): `src/app.py`
- **Validation images**
- [Leaderboard view](https://github.com/lukasmosser/seismic-arena/blob/main/src/app.py): `src/app.py`

### Model inference

- [Prediction endpoint](https://github.com/lukasmosser/seismic-arena/blob/main/src/model_endpoints.py): `src/model_endpoints.py`
- [GPU model runner](https://github.com/lukasmosser/seismic-arena/blob/main/src/model_endpoints.py): `src/model_endpoints.py`
- [Baseline model wrapper](https://github.com/lukasmosser/seismic-arena/blob/main/src/models/unet_model.py): `src/models/unet_model.py`

### Ratings service

- [Battle and ratings API](https://github.com/lukasmosser/seismic-arena/blob/main/src/score_db.py): `src/score_db.py`
- [Battle volume](https://github.com/lukasmosser/seismic-arena/blob/main/src/score_db.py): `src/score_db.py`

### Internal layers

- [UNet architecture](https://github.com/lukasmosser/seismic-arena/blob/main/src/models/unet_model_dropout.py): `src/models/unet_model_dropout.py`
- [Elo calculation](https://github.com/lukasmosser/seismic-arena/blob/main/src/rating.py): `src/rating.py`

### Other components

- **Human judge**
- **Dataset host**
- **Model weight host**

## Connections

- Human judge → Arena and UI: rates models (evidence: `README.md`)
- Arena and UI → Dataset host: loads samples (evidence: `src/app.py`)
- Dataset host → Validation images: provides images
- Arena and UI → Prediction endpoint: requests predictions (evidence: `src/app.py`)
- Prediction endpoint → GPU model runner: dispatches inference (evidence: `src/model_endpoints.py`)
- GPU model runner → Baseline model wrapper: loads model (evidence: `src/model_endpoints.py`)
- Baseline model wrapper → UNet architecture: uses architecture (evidence: `src/models/unet_model.py`)
- GPU model runner → Model weight host: loads weights
- Arena and UI → Battle and ratings API: submits battles (evidence: `src/app.py`)
- Battle and ratings API → Battle volume: writes battles (evidence: `src/score_db.py`)
- Battle and ratings API → Battle volume: reads battles (evidence: `src/score_db.py`)
- Battle and ratings API → Elo calculation: computes ratings (evidence: `src/score_db.py`)
- Arena and UI → Leaderboard view: opens leaderboard (evidence: `README.md`)
- Leaderboard view → Battle and ratings API: fetches ratings (evidence: `src/app.py`)
- Battle and ratings API → Leaderboard view: returns ratings (evidence: `README.md`)
