# bishti04062005/coralclear-ai architecture

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

- Interactive diagram: https://gitdiagram.com/bishti04062005/coralclear-ai
- Repository: https://github.com/bishti04062005/coralclear-ai

## Overview

CoralClear AI is a research-oriented coral-health classifier and Streamlit application. Its user workflow is image upload → per-model preprocessing and inference → threshold-based healthy/bleached predictions, optionally across seven models. The application also exposes research and external-validation results. Separately, the repository contains dataset preparation, model-training and image-enhancement experiments, evaluation, and statistical/reporting tools. Some of these research links are documented in the README but their full implementations were not sampled; those relationships are omitted or marked unverified.

Main entry points: [`ml/app/inference.py`](https://github.com/bishti04062005/coralclear-ai/blob/main/ml/app/inference.py) (Prediction inference), [`ml/app/app.py`](https://github.com/bishti04062005/coralclear-ai/blob/main/ml/app/app.py) (Streamlit app), [`external_evaluation.py`](https://github.com/bishti04062005/coralclear-ai/blob/main/external_evaluation.py) (External evaluation), [`bootstrap_analysis.py`](https://github.com/bishti04062005/coralclear-ai/blob/main/bootstrap_analysis.py) (Statistical analysis)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_application["User application"]
  node_streamlit["Streamlit app<br/>[app.py]"]
  node_dashboard_data[("Dashboard results")]
end

subgraph group_inference["Inference and models"]
  node_inference_api["Prediction inference<br/>[inference.py]"]
  node_checkpoints[("Model checkpoints")]
  node_hf_models[("Private HF models")]
end

subgraph group_research["Research workflow"]
  node_dataset[("Coral image dataset")]
  node_data_pipeline["Dataset pipeline<br/>[data_pipeline.py]"]
  node_training["Model training<br/>[train.py]"]
  node_fine_tuning["Fine tuning<br/>[fine_tune.py]"]
  node_enhancement["Enhancement experiments"]
end

subgraph group_evaluation["Evaluation and reporting"]
  node_external_eval["External evaluation"]
  node_statistical["Statistical analysis"]
  node_figures["Research figures"]
  node_tables["Research tables"]
  node_report["Research report"]
end

node_user(("Image uploader"))

node_user -->|"uploads image"| node_streamlit
node_streamlit -->|"requests prediction"| node_inference_api
node_inference_api -->|"loads checkpoint"| node_checkpoints
node_inference_api -->|"downloads checkpoint"| node_hf_models
node_streamlit -->|"reads results"| node_dashboard_data
node_dataset -->|"loads images"| node_data_pipeline
node_data_pipeline -.->|"supplies datasets"| node_training
node_training -.->|"extends baseline"| node_fine_tuning
node_enhancement -.->|"tests configurations"| node_training
node_inference_api -->|"provides inference"| node_external_eval
node_external_eval -.->|"yields predictions"| node_statistical
node_external_eval -.->|"provides metrics"| node_figures
node_statistical -.->|"summarizes results"| node_tables
node_statistical -.->|"informs report"| node_report
node_dashboard_data -->|"feeds dashboard"| node_streamlit

click node_streamlit "https://github.com/bishti04062005/coralclear-ai/blob/main/ml/app/app.py"
click node_inference_api "https://github.com/bishti04062005/coralclear-ai/blob/main/ml/app/inference.py"
click node_checkpoints "https://github.com/bishti04062005/coralclear-ai/tree/main/ml/models"
click node_data_pipeline "https://github.com/bishti04062005/coralclear-ai/blob/main/ml/src/data_pipeline.py"
click node_training "https://github.com/bishti04062005/coralclear-ai/blob/main/ml/src/train.py"
click node_fine_tuning "https://github.com/bishti04062005/coralclear-ai/blob/main/ml/src/fine_tune.py"
click node_enhancement "https://github.com/bishti04062005/coralclear-ai/tree/main/ml/src"
click node_external_eval "https://github.com/bishti04062005/coralclear-ai/blob/main/external_evaluation.py"
click node_statistical "https://github.com/bishti04062005/coralclear-ai/blob/main/bootstrap_analysis.py"
click node_figures "https://github.com/bishti04062005/coralclear-ai/blob/main/create_research_figures.py"
click node_tables "https://github.com/bishti04062005/coralclear-ai/blob/main/create_research_tables.py"
click node_report "https://github.com/bishti04062005/coralclear-ai/blob/main/ml/src/stage4_13_4_generate_research_report.py"
click node_dashboard_data "https://github.com/bishti04062005/coralclear-ai/tree/main/ml/experiments"

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_streamlit,node_dashboard_data toneBlue
class node_inference_api,node_checkpoints,node_hf_models toneAmber
class node_dataset,node_data_pipeline,node_training,node_fine_tuning,node_enhancement toneMint
class node_external_eval,node_statistical,node_figures,node_tables,node_report toneRose
class node_user toneIndigo
```

## Components

### User application

- [Streamlit app](https://github.com/bishti04062005/coralclear-ai/blob/main/ml/app/app.py): `ml/app/app.py`
- [Dashboard results](https://github.com/bishti04062005/coralclear-ai/tree/main/ml/experiments): `ml/experiments`

### Inference and models

- [Prediction inference](https://github.com/bishti04062005/coralclear-ai/blob/main/ml/app/inference.py): `ml/app/inference.py`
- [Model checkpoints](https://github.com/bishti04062005/coralclear-ai/tree/main/ml/models): `ml/models`
- **Private HF models**

### Research workflow

- **Coral image dataset**
- [Dataset pipeline](https://github.com/bishti04062005/coralclear-ai/blob/main/ml/src/data_pipeline.py): `ml/src/data_pipeline.py`
- [Model training](https://github.com/bishti04062005/coralclear-ai/blob/main/ml/src/train.py): `ml/src/train.py`
- [Fine tuning](https://github.com/bishti04062005/coralclear-ai/blob/main/ml/src/fine_tune.py): `ml/src/fine_tune.py`
- [Enhancement experiments](https://github.com/bishti04062005/coralclear-ai/tree/main/ml/src): `ml/src`

### Evaluation and reporting

- [External evaluation](https://github.com/bishti04062005/coralclear-ai/blob/main/external_evaluation.py): `external_evaluation.py`
- [Statistical analysis](https://github.com/bishti04062005/coralclear-ai/blob/main/bootstrap_analysis.py): `bootstrap_analysis.py`
- [Research figures](https://github.com/bishti04062005/coralclear-ai/blob/main/create_research_figures.py): `create_research_figures.py`
- [Research tables](https://github.com/bishti04062005/coralclear-ai/blob/main/create_research_tables.py): `create_research_tables.py`
- [Research report](https://github.com/bishti04062005/coralclear-ai/blob/main/ml/src/stage4_13_4_generate_research_report.py): `ml/src/stage4_13_4_generate_research_report.py`

### Other components

- **Image uploader**

## Connections

- Image uploader → Streamlit app: uploads image (evidence: `README.md`)
- Streamlit app → Prediction inference: requests prediction (evidence: `ml/app/app.py`)
- Prediction inference → Model checkpoints: loads checkpoint (evidence: `README.md`)
- Prediction inference → Private HF models: downloads checkpoint (evidence: `ml/app/inference.py`)
- Streamlit app → Dashboard results: reads results (evidence: `ml/app/app.py`)
- Coral image dataset → Dataset pipeline: loads images (evidence: `ml/src/data_pipeline.py`)
- Dataset pipeline → Model training: supplies datasets
- Model training → Fine tuning: extends baseline
- Enhancement experiments → Model training: tests configurations (evidence: `README.md`)
- Prediction inference → External evaluation: provides inference (evidence: `external_evaluation.py`)
- External evaluation → Statistical analysis: yields predictions
- External evaluation → Research figures: provides metrics
- Statistical analysis → Research tables: summarizes results
- Statistical analysis → Research report: informs report
- Dashboard results → Streamlit app: feeds dashboard (evidence: `ml/app/app.py`)
