# sohom-chakma/malaria-api architecture

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

- Interactive diagram: https://gitdiagram.com/sohom-chakma/malaria-api
- Repository: https://github.com/sohom-chakma/malaria-api

## Overview

This repository provides a FastAPI service for malaria-image detection, plus a direct image-file inference mode. The main API workflow accepts image uploads, decodes supported formats, invokes YOLO inference, and returns per-image detections and status. A separate endpoint reports model configuration. The graph reflects the shown calls and model loading; README documentation is empty, and no other service integrations are evidenced.

Main entry points: [`inference.py`](https://github.com/sohom-chakma/malaria-api/blob/main/inference.py) (YOLO inference), [`main.py`](https://github.com/sohom-chakma/malaria-api/blob/main/main.py) (Prediction endpoint), [`yolov26m.pt`](https://github.com/sohom-chakma/malaria-api/blob/main/yolov26m.pt) (Model weights)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["HTTP API"]
  node_routes["Prediction endpoint<br/>[main.py]"]
  node_metadata["Model metadata<br/>[main.py]"]
end

subgraph group_image["Image handling"]
  node_decode["Image decoder<br/>[main.py]"]
end

subgraph group_inference["Model inference"]
  node_predict["YOLO inference<br/>[inference.py]"]
  node_weights["Model weights<br/>[yolov26m.pt]"]
  node_cli["File inference CLI<br/>[inference.py]"]
end

node_client(("API client"))
node_ultralytics["Ultralytics YOLO"]
node_file_user(("CLI user"))

node_client -->|"uploads images"| node_routes
node_routes -->|"decodes images"| node_decode
node_routes -->|"invokes inference"| node_predict
node_routes -->|"returns results"| node_client
node_client -->|"requests metadata"| node_metadata
node_metadata -->|"returns configuration"| node_client
node_metadata -->|"reads model settings"| node_predict
node_predict -->|"loads weights"| node_weights
node_predict -->|"runs prediction"| node_ultralytics
node_file_user -->|"provides image paths"| node_cli
node_cli -->|"invokes inference"| node_predict

click node_routes "https://github.com/sohom-chakma/malaria-api/blob/main/main.py"
click node_metadata "https://github.com/sohom-chakma/malaria-api/blob/main/main.py"
click node_decode "https://github.com/sohom-chakma/malaria-api/blob/main/main.py"
click node_predict "https://github.com/sohom-chakma/malaria-api/blob/main/inference.py"
click node_weights "https://github.com/sohom-chakma/malaria-api/blob/main/yolov26m.pt"
click node_cli "https://github.com/sohom-chakma/malaria-api/blob/main/inference.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_routes,node_metadata,node_client,node_file_user toneBlue
class node_decode toneAmber
class node_predict,node_weights,node_cli toneMint
class node_ultralytics toneIndigo
```

## Components

### HTTP API

- [Prediction endpoint](https://github.com/sohom-chakma/malaria-api/blob/main/main.py): `main.py`
- [Model metadata](https://github.com/sohom-chakma/malaria-api/blob/main/main.py): `main.py`

### Image handling

- [Image decoder](https://github.com/sohom-chakma/malaria-api/blob/main/main.py): `main.py`

### Model inference

- [YOLO inference](https://github.com/sohom-chakma/malaria-api/blob/main/inference.py): `inference.py`
- [Model weights](https://github.com/sohom-chakma/malaria-api/blob/main/yolov26m.pt): `yolov26m.pt`
- [File inference CLI](https://github.com/sohom-chakma/malaria-api/blob/main/inference.py): `inference.py`

### Other components

- **API client**
- **Ultralytics YOLO**
- **CLI user**

## Connections

- API client → Prediction endpoint: uploads images (evidence: `main.py`)
- Prediction endpoint → Image decoder: decodes images (evidence: `main.py`)
- Prediction endpoint → YOLO inference: invokes inference (evidence: `main.py`)
- Prediction endpoint → API client: returns results (evidence: `main.py`)
- API client → Model metadata: requests metadata (evidence: `main.py`)
- Model metadata → API client: returns configuration (evidence: `main.py`)
- Model metadata → YOLO inference: reads model settings (evidence: `main.py`)
- YOLO inference → Model weights: loads weights (evidence: `inference.py`)
- YOLO inference → Ultralytics YOLO: runs prediction (evidence: `inference.py`)
- CLI user → File inference CLI: provides image paths (evidence: `inference.py`)
- File inference CLI → YOLO inference: invokes inference (evidence: `inference.py`)
