# anubhabmondal496-coder/attention-seeker architecture

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

- Interactive diagram: https://gitdiagram.com/anubhabmondal496-coder/attention-seeker
- Repository: https://github.com/anubhabmondal496-coder/attention-seeker

## Overview

Attention Seeker is a multimodal visual-search assistant: users describe and photograph a lost object, then submit sampled camera frames for fast candidate detection, detailed verification, and directional guidance. The backend exposes these stages through FastAPI and isolates Gemma inference behind a configurable service. The README also documents multiple inference backends and a Flutter client, but the supplied tree contains no Flutter/Dart application sources. Links for documented-but-unsampled capabilities rely on the README; other relationships are limited to shown excerpts and SOURCE INDEX references.

Main entry points: [`backend/main.py`](https://github.com/anubhabmondal496-coder/attention-seeker/blob/main/backend/main.py) (FastAPI App), [`backend/routes/candidate.py`](https://github.com/anubhabmondal496-coder/attention-seeker/blob/main/backend/routes/candidate.py) (Candidate Endpoints), [`backend/services/gemma_service.py`](https://github.com/anubhabmondal496-coder/attention-seeker/blob/main/backend/services/gemma_service.py) (Gemma Service), [`backend/models/target.py`](https://github.com/anubhabmondal496-coder/attention-seeker/blob/main/backend/models/target.py) (Target Profile)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API and State"]
  node_api_app["FastAPI App<br/>[main.py]"]
  node_search_state["Search State<br/>[state.py]"]
  node_config["Inference Config<br/>[config.py]"]
end

subgraph group_target["Target Profiling"]
  node_target_route["Target Endpoint<br/>[target.py]"]
  node_target_analyzer["Target Analyzer<br/>[target_analyzer.py]"]
  node_target_model["Target Profile<br/>[target.py]"]
end

subgraph group_search["Candidate Search"]
  node_candidate_route["Candidate Endpoints<br/>[candidate.py]"]
  node_candidate_detector["Candidate Detector"]
  node_candidate_model["Candidate Schema<br/>[candidate.py]"]
  node_verifier["Candidate Verifier"]
  node_verification_model["Verification Schema<br/>[verification.py]"]
end

subgraph group_guidance["Guidance"]
  node_guidance_route["Decision Endpoint<br/>[search.py]"]
  node_guidance_service["Guidance Engine"]
  node_guidance_model["Guidance Schema<br/>[guidance.py]"]
end

subgraph group_inference["Inference"]
  node_gemma["Gemma Service<br/>[gemma_service.py]"]
  node_inference_providers["Inference Providers"]
end

node_user(("User"))
node_client["Flutter Client"]

node_user -.->|"provides target and frames"| node_client
node_client -.->|"calls search API"| node_api_app
node_api_app -->|"registers routes"| node_target_route
node_api_app -->|"registers routes"| node_candidate_route
node_api_app -->|"registers routes"| node_guidance_route
node_api_app -->|"reads settings"| node_config
node_api_app -->|"reports health state"| node_search_state
node_target_route -->|"analyzes target"| node_target_analyzer
node_target_route -->|"validates and returns"| node_target_model
node_target_analyzer -->|"extracts profile"| node_target_model
node_target_analyzer -->|"requests inference"| node_gemma
node_candidate_route -->|"detects candidates"| node_candidate_detector
node_candidate_route -->|"verifies crop"| node_verifier
node_candidate_route -->|"parses profile"| node_target_model
node_candidate_route -->|"returns detection schema"| node_candidate_model
node_candidate_detector -->|"compares profile"| node_target_model
node_candidate_detector -->|"produces candidates"| node_candidate_model
node_verifier -->|"requests comparison"| node_gemma
node_verifier -->|"compares target profile"| node_target_model
node_verifier -->|"returns verification"| node_verification_model
node_guidance_route -->|"decides guidance"| node_guidance_service
node_guidance_service -->|"evaluates request and responds"| node_guidance_model
node_guidance_service -->|"checks verification status"| node_verification_model
node_gemma -->|"loads backend settings"| node_config
node_gemma -->|"dispatches inference"| node_inference_providers
node_inference_providers -.->|"returns model output"| node_gemma

click node_client "https://github.com/anubhabmondal496-coder/attention-seeker/tree/main/frontend"
click node_api_app "https://github.com/anubhabmondal496-coder/attention-seeker/blob/main/backend/main.py"
click node_search_state "https://github.com/anubhabmondal496-coder/attention-seeker/blob/main/backend/app/state.py"
click node_config "https://github.com/anubhabmondal496-coder/attention-seeker/blob/main/backend/app/config.py"
click node_target_route "https://github.com/anubhabmondal496-coder/attention-seeker/blob/main/backend/routes/target.py"
click node_target_analyzer "https://github.com/anubhabmondal496-coder/attention-seeker/blob/main/backend/services/target_analyzer.py"
click node_target_model "https://github.com/anubhabmondal496-coder/attention-seeker/blob/main/backend/models/target.py"
click node_candidate_route "https://github.com/anubhabmondal496-coder/attention-seeker/blob/main/backend/routes/candidate.py"
click node_candidate_detector "https://github.com/anubhabmondal496-coder/attention-seeker/blob/main/backend/services/candidate_detector.py"
click node_candidate_model "https://github.com/anubhabmondal496-coder/attention-seeker/blob/main/backend/models/candidate.py"
click node_verifier "https://github.com/anubhabmondal496-coder/attention-seeker/blob/main/backend/services/verifier_service.py"
click node_verification_model "https://github.com/anubhabmondal496-coder/attention-seeker/blob/main/backend/models/verification.py"
click node_guidance_route "https://github.com/anubhabmondal496-coder/attention-seeker/blob/main/backend/routes/search.py"
click node_guidance_service "https://github.com/anubhabmondal496-coder/attention-seeker/blob/main/backend/services/guidance_service.py"
click node_guidance_model "https://github.com/anubhabmondal496-coder/attention-seeker/blob/main/backend/models/guidance.py"
click node_gemma "https://github.com/anubhabmondal496-coder/attention-seeker/blob/main/backend/services/gemma_service.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_api_app,node_search_state,node_config,node_user,node_client toneBlue
class node_target_route,node_target_analyzer,node_target_model toneAmber
class node_candidate_route,node_candidate_detector,node_candidate_model,node_verifier,node_verification_model toneMint
class node_guidance_route,node_guidance_service,node_guidance_model toneRose
class node_gemma,node_inference_providers toneIndigo
```

## Components

### API and State

- [FastAPI App](https://github.com/anubhabmondal496-coder/attention-seeker/blob/main/backend/main.py): `backend/main.py`
- [Search State](https://github.com/anubhabmondal496-coder/attention-seeker/blob/main/backend/app/state.py): `backend/app/state.py`
- [Inference Config](https://github.com/anubhabmondal496-coder/attention-seeker/blob/main/backend/app/config.py): `backend/app/config.py`

### Target Profiling

- [Target Endpoint](https://github.com/anubhabmondal496-coder/attention-seeker/blob/main/backend/routes/target.py): `backend/routes/target.py`
- [Target Analyzer](https://github.com/anubhabmondal496-coder/attention-seeker/blob/main/backend/services/target_analyzer.py): `backend/services/target_analyzer.py`
- [Target Profile](https://github.com/anubhabmondal496-coder/attention-seeker/blob/main/backend/models/target.py): `backend/models/target.py`

### Candidate Search

- [Candidate Endpoints](https://github.com/anubhabmondal496-coder/attention-seeker/blob/main/backend/routes/candidate.py): `backend/routes/candidate.py`
- [Candidate Detector](https://github.com/anubhabmondal496-coder/attention-seeker/blob/main/backend/services/candidate_detector.py): `backend/services/candidate_detector.py`
- [Candidate Schema](https://github.com/anubhabmondal496-coder/attention-seeker/blob/main/backend/models/candidate.py): `backend/models/candidate.py`
- [Candidate Verifier](https://github.com/anubhabmondal496-coder/attention-seeker/blob/main/backend/services/verifier_service.py): `backend/services/verifier_service.py`
- [Verification Schema](https://github.com/anubhabmondal496-coder/attention-seeker/blob/main/backend/models/verification.py): `backend/models/verification.py`

### Guidance

- [Decision Endpoint](https://github.com/anubhabmondal496-coder/attention-seeker/blob/main/backend/routes/search.py): `backend/routes/search.py`
- [Guidance Engine](https://github.com/anubhabmondal496-coder/attention-seeker/blob/main/backend/services/guidance_service.py): `backend/services/guidance_service.py`
- [Guidance Schema](https://github.com/anubhabmondal496-coder/attention-seeker/blob/main/backend/models/guidance.py): `backend/models/guidance.py`

### Inference

- [Gemma Service](https://github.com/anubhabmondal496-coder/attention-seeker/blob/main/backend/services/gemma_service.py): `backend/services/gemma_service.py`
- **Inference Providers**

### Other components

- **User**
- [Flutter Client](https://github.com/anubhabmondal496-coder/attention-seeker/tree/main/frontend): `frontend`

## Connections

- User → Flutter Client: provides target and frames (evidence: `README.md`)
- Flutter Client → FastAPI App: calls search API (evidence: `README.md`)
- FastAPI App → Target Endpoint: registers routes (evidence: `backend/main.py`)
- FastAPI App → Candidate Endpoints: registers routes (evidence: `backend/main.py`)
- FastAPI App → Decision Endpoint: registers routes (evidence: `backend/main.py`)
- FastAPI App → Inference Config: reads settings (evidence: `backend/main.py`)
- FastAPI App → Search State: reports health state (evidence: `backend/main.py`)
- Target Endpoint → Target Analyzer: analyzes target (evidence: `backend/routes/target.py`)
- Target Endpoint → Target Profile: validates and returns (evidence: `backend/routes/target.py`)
- Target Analyzer → Target Profile: extracts profile (evidence: `backend/services/target_analyzer.py`)
- Target Analyzer → Gemma Service: requests inference (evidence: `backend/services/target_analyzer.py`)
- Candidate Endpoints → Candidate Detector: detects candidates (evidence: `backend/routes/candidate.py`)
- Candidate Endpoints → Candidate Verifier: verifies crop (evidence: `backend/routes/candidate.py`)
- Candidate Endpoints → Target Profile: parses profile (evidence: `backend/routes/candidate.py`)
- Candidate Endpoints → Candidate Schema: returns detection schema (evidence: `backend/routes/candidate.py`)
- Candidate Detector → Target Profile: compares profile (evidence: `backend/services/candidate_detector.py`)
- Candidate Detector → Candidate Schema: produces candidates (evidence: `backend/services/candidate_detector.py`)
- Candidate Verifier → Gemma Service: requests comparison (evidence: `backend/services/verifier_service.py`)
- Candidate Verifier → Target Profile: compares target profile (evidence: `backend/services/verifier_service.py`)
- Candidate Verifier → Verification Schema: returns verification (evidence: `backend/services/verifier_service.py`)
- Decision Endpoint → Guidance Engine: decides guidance (evidence: `backend/routes/search.py`)
- Guidance Engine → Guidance Schema: evaluates request and responds (evidence: `backend/services/guidance_service.py`)
- Guidance Engine → Verification Schema: checks verification status (evidence: `backend/services/guidance_service.py`)
- Gemma Service → Inference Config: loads backend settings (evidence: `backend/services/gemma_service.py`)
- Gemma Service → Inference Providers: dispatches inference (evidence: `backend/services/gemma_service.py`)
- Inference Providers → Gemma Service: returns model output (evidence: `README.md`)
