# snehithraj-1/infra-clarity-ai architecture

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

- Interactive diagram: https://gitdiagram.com/snehithraj-1/infra-clarity-ai
- Repository: https://github.com/snehithraj-1/infra-clarity-ai

## Overview

InfraClarity AI restores and analyzes utility inspection images through either a Streamlit demo or a React/FastAPI platform. In the main workflow, an inspector uploads or selects an image, requests restoration or analysis, and reviews results and history. The backend processor dispatches restoration, analysis and metrics work; a separate research path prepares degradation data, trains a restorer and benchmarks it. README-described capabilities include hallucination-risk checks, super-resolution, image comparison and downloadable results. Some frontend routing and unsampled subsystem wiring are not shown, so uncertain links are omitted.

Main entry points: [`backend/image_processor.py`](https://github.com/snehithraj-1/infra-clarity-ai/blob/main/backend/image_processor.py) (Image Processor), [`frontend/src/App.jsx`](https://github.com/snehithraj-1/infra-clarity-ai/blob/main/frontend/src/App.jsx) (React App), [`frontend/src/services/api.js`](https://github.com/snehithraj-1/infra-clarity-ai/blob/main/frontend/src/services/api.js) (REST API Client), [`src/evaluation.py`](https://github.com/snehithraj-1/infra-clarity-ai/blob/main/src/evaluation.py) (Benchmark Evaluation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["Inspection Interfaces"]
  node_react_app["React App<br/>[App.jsx]"]
  node_studio["Enhancement Studio"]
  node_analysis_page["Analysis View<br/>[ImageAnalysis.jsx]"]
  node_dashboard["Dashboard<br/>[Dashboard.jsx]"]
  node_history_page["Processing History"]
  node_comparison["Before/After Slider"]
  node_api_client["REST API Client<br/>[api.js]"]
  node_streamlit["Streamlit App<br/>[streamlit_app.py]"]
end

subgraph group_service["API and Processing"]
  node_fastapi["FastAPI Routes<br/>[main.py]"]
  node_processor["Image Processor<br/>[image_processor.py]"]
  node_history_store[("History Records<br/>[image_processor.py]")]
end

subgraph group_restoration["Restoration and Analysis"]
  node_classical["Enhancement Methods<br/>[enhancement.py]"]
  node_superres["Super-Resolution"]
  node_diffusion["Diffusion Restoration"]
  node_diagnostics["Image Diagnostics<br/>[image_analysis.py]"]
  node_metrics["Quality Metrics<br/>[metrics.py]"]
end

subgraph group_research["Model Development"]
  node_degradation["Degradation Synthesis<br/>[degradation.py]"]
  node_preprocessing["Dataset Preprocessing<br/>[preprocessing.py]"]
  node_model["Restoration Model Training<br/>[training.py]"]
  node_research_enhancement["Unified Restoration Interface<br/>[enhancement.py]"]
  node_evaluation["Benchmark Evaluation<br/>[evaluation.py]"]
end

node_inspector(("Inspector"))

node_inspector -->|"uses"| node_react_app
node_inspector -->|"uses"| node_streamlit
node_react_app -->|"requests data"| node_api_client
node_react_app -.->|"renders"| node_dashboard
node_react_app -.->|"renders"| node_studio
node_react_app -.->|"renders"| node_analysis_page
node_react_app -->|"renders"| node_history_page
node_studio -->|"uploads and enhances"| node_api_client
node_studio -->|"renders"| node_comparison
node_analysis_page -->|"requests analysis"| node_api_client
node_history_page -->|"requests history"| node_api_client
node_api_client -->|"sends REST requests"| node_fastapi
node_fastapi -->|"dispatches image work"| node_processor
node_streamlit -->|"uses processing"| node_processor
node_processor -->|"reads and writes"| node_history_store
node_processor -->|"dispatches restoration"| node_classical
node_processor -->|"dispatches scaling"| node_superres
node_processor -->|"dispatches restoration"| node_diffusion
node_processor -->|"runs analysis"| node_diagnostics
node_processor -->|"computes metrics"| node_metrics
node_model -->|"loads batches"| node_preprocessing
node_evaluation -->|"evaluates model"| node_model
node_evaluation -->|"benchmarks restoration"| node_research_enhancement
node_evaluation -->|"benchmarks scaling"| node_superres
node_evaluation -->|"uses metrics"| node_metrics

click node_react_app "https://github.com/snehithraj-1/infra-clarity-ai/blob/main/frontend/src/App.jsx"
click node_studio "https://github.com/snehithraj-1/infra-clarity-ai/blob/main/frontend/src/pages/EnhancementStudio.jsx"
click node_analysis_page "https://github.com/snehithraj-1/infra-clarity-ai/blob/main/frontend/src/pages/ImageAnalysis.jsx"
click node_dashboard "https://github.com/snehithraj-1/infra-clarity-ai/blob/main/frontend/src/pages/Dashboard.jsx"
click node_history_page "https://github.com/snehithraj-1/infra-clarity-ai/blob/main/frontend/src/pages/ProcessingHistory.jsx"
click node_comparison "https://github.com/snehithraj-1/infra-clarity-ai/blob/main/frontend/src/components/BeforeAfterSlider.jsx"
click node_api_client "https://github.com/snehithraj-1/infra-clarity-ai/blob/main/frontend/src/services/api.js"
click node_streamlit "https://github.com/snehithraj-1/infra-clarity-ai/blob/main/streamlit_app.py"
click node_fastapi "https://github.com/snehithraj-1/infra-clarity-ai/blob/main/backend/main.py"
click node_processor "https://github.com/snehithraj-1/infra-clarity-ai/blob/main/backend/image_processor.py"
click node_history_store "https://github.com/snehithraj-1/infra-clarity-ai/blob/main/backend/image_processor.py"
click node_classical "https://github.com/snehithraj-1/infra-clarity-ai/blob/main/backend/enhancement.py"
click node_superres "https://github.com/snehithraj-1/infra-clarity-ai/blob/main/backend/super_resolution.py"
click node_diffusion "https://github.com/snehithraj-1/infra-clarity-ai/blob/main/backend/diffusion_restoration.py"
click node_diagnostics "https://github.com/snehithraj-1/infra-clarity-ai/blob/main/backend/image_analysis.py"
click node_metrics "https://github.com/snehithraj-1/infra-clarity-ai/blob/main/backend/metrics.py"
click node_degradation "https://github.com/snehithraj-1/infra-clarity-ai/blob/main/src/degradation.py"
click node_preprocessing "https://github.com/snehithraj-1/infra-clarity-ai/blob/main/src/preprocessing.py"
click node_model "https://github.com/snehithraj-1/infra-clarity-ai/blob/main/src/training.py"
click node_research_enhancement "https://github.com/snehithraj-1/infra-clarity-ai/blob/main/src/enhancement.py"
click node_evaluation "https://github.com/snehithraj-1/infra-clarity-ai/blob/main/src/evaluation.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_react_app,node_studio,node_analysis_page,node_dashboard,node_history_page,node_comparison,node_api_client,node_streamlit toneBlue
class node_fastapi,node_processor,node_history_store toneAmber
class node_classical,node_superres,node_diffusion,node_diagnostics,node_metrics toneMint
class node_degradation,node_preprocessing,node_model,node_research_enhancement,node_evaluation toneRose
class node_inspector toneIndigo
```

## Components

### Inspection Interfaces

- [React App](https://github.com/snehithraj-1/infra-clarity-ai/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Enhancement Studio](https://github.com/snehithraj-1/infra-clarity-ai/blob/main/frontend/src/pages/EnhancementStudio.jsx): `frontend/src/pages/EnhancementStudio.jsx`
- [Analysis View](https://github.com/snehithraj-1/infra-clarity-ai/blob/main/frontend/src/pages/ImageAnalysis.jsx): `frontend/src/pages/ImageAnalysis.jsx`
- [Dashboard](https://github.com/snehithraj-1/infra-clarity-ai/blob/main/frontend/src/pages/Dashboard.jsx): `frontend/src/pages/Dashboard.jsx`
- [Processing History](https://github.com/snehithraj-1/infra-clarity-ai/blob/main/frontend/src/pages/ProcessingHistory.jsx): `frontend/src/pages/ProcessingHistory.jsx`
- [Before/After Slider](https://github.com/snehithraj-1/infra-clarity-ai/blob/main/frontend/src/components/BeforeAfterSlider.jsx): `frontend/src/components/BeforeAfterSlider.jsx`
- [REST API Client](https://github.com/snehithraj-1/infra-clarity-ai/blob/main/frontend/src/services/api.js): `frontend/src/services/api.js`
- [Streamlit App](https://github.com/snehithraj-1/infra-clarity-ai/blob/main/streamlit_app.py): `streamlit_app.py`

### API and Processing

- [FastAPI Routes](https://github.com/snehithraj-1/infra-clarity-ai/blob/main/backend/main.py): `backend/main.py`
- [Image Processor](https://github.com/snehithraj-1/infra-clarity-ai/blob/main/backend/image_processor.py): `backend/image_processor.py`
- [History Records](https://github.com/snehithraj-1/infra-clarity-ai/blob/main/backend/image_processor.py): `backend/image_processor.py`

### Restoration and Analysis

- [Enhancement Methods](https://github.com/snehithraj-1/infra-clarity-ai/blob/main/backend/enhancement.py): `backend/enhancement.py`
- [Super-Resolution](https://github.com/snehithraj-1/infra-clarity-ai/blob/main/backend/super_resolution.py): `backend/super_resolution.py`
- [Diffusion Restoration](https://github.com/snehithraj-1/infra-clarity-ai/blob/main/backend/diffusion_restoration.py): `backend/diffusion_restoration.py`
- [Image Diagnostics](https://github.com/snehithraj-1/infra-clarity-ai/blob/main/backend/image_analysis.py): `backend/image_analysis.py`
- [Quality Metrics](https://github.com/snehithraj-1/infra-clarity-ai/blob/main/backend/metrics.py): `backend/metrics.py`

### Model Development

- [Degradation Synthesis](https://github.com/snehithraj-1/infra-clarity-ai/blob/main/src/degradation.py): `src/degradation.py`
- [Dataset Preprocessing](https://github.com/snehithraj-1/infra-clarity-ai/blob/main/src/preprocessing.py): `src/preprocessing.py`
- [Restoration Model Training](https://github.com/snehithraj-1/infra-clarity-ai/blob/main/src/training.py): `src/training.py`
- [Unified Restoration Interface](https://github.com/snehithraj-1/infra-clarity-ai/blob/main/src/enhancement.py): `src/enhancement.py`
- [Benchmark Evaluation](https://github.com/snehithraj-1/infra-clarity-ai/blob/main/src/evaluation.py): `src/evaluation.py`

### Other components

- **Inspector**

## Connections

- Inspector → React App: uses (evidence: `README.md`)
- Inspector → Streamlit App: uses (evidence: `README.md`)
- React App → REST API Client: requests data (evidence: `frontend/src/App.jsx`)
- React App → Dashboard: renders (evidence: `frontend/src/App.jsx`)
- React App → Enhancement Studio: renders (evidence: `frontend/src/App.jsx`)
- React App → Analysis View: renders (evidence: `frontend/src/App.jsx`)
- React App → Processing History: renders (evidence: `frontend/src/App.jsx`)
- Enhancement Studio → REST API Client: uploads and enhances (evidence: `frontend/src/pages/EnhancementStudio.jsx`)
- Enhancement Studio → Before/After Slider: renders (evidence: `frontend/src/pages/EnhancementStudio.jsx`)
- Analysis View → REST API Client: requests analysis (evidence: `frontend/src/pages/ImageAnalysis.jsx`)
- Processing History → REST API Client: requests history (evidence: `frontend/src/pages/ProcessingHistory.jsx`)
- REST API Client → FastAPI Routes: sends REST requests (evidence: `README.md`)
- FastAPI Routes → Image Processor: dispatches image work (evidence: `backend/main.py`)
- Streamlit App → Image Processor: uses processing (evidence: `streamlit_app.py`)
- Image Processor → History Records: reads and writes (evidence: `backend/image_processor.py`)
- Image Processor → Enhancement Methods: dispatches restoration (evidence: `backend/image_processor.py`)
- Image Processor → Super-Resolution: dispatches scaling (evidence: `backend/image_processor.py`)
- Image Processor → Diffusion Restoration: dispatches restoration (evidence: `backend/image_processor.py`)
- Image Processor → Image Diagnostics: runs analysis (evidence: `backend/image_processor.py`)
- Image Processor → Quality Metrics: computes metrics (evidence: `backend/image_processor.py`)
- Restoration Model Training → Dataset Preprocessing: loads batches (evidence: `src/training.py`)
- Benchmark Evaluation → Restoration Model Training: evaluates model (evidence: `src/evaluation.py`)
- Benchmark Evaluation → Unified Restoration Interface: benchmarks restoration (evidence: `src/evaluation.py`)
- Benchmark Evaluation → Super-Resolution: benchmarks scaling (evidence: `src/evaluation.py`)
- Benchmark Evaluation → Quality Metrics: uses metrics (evidence: `src/evaluation.py`)
