# bikas-basnet/crop_abnormality_app architecture

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

- Interactive diagram: https://gitdiagram.com/bikas-basnet/crop_abnormality_app
- Repository: https://github.com/bikas-basnet/crop_abnormality_app

## Overview

NepAgNeuroVision is a Flask-based crop-abnormality diagnosis app. A user submits a crop image and crop selection; the app verifies the crop, runs the crop-specific classifier, and presents a diagnosis with confidence and localized management advice. The sampled app excerpt shows the model configuration, inference-related decisions, and rendering calls; the README documents additional interface and prediction capabilities. Most runtime behavior is concentrated in app.py, so multiple nodes point to that file. The sampled excerpts do not expose every route or inference detail.

Main entry points: [`app.py`](https://github.com/bikas-basnet/crop_abnormality_app/blob/main/app.py) (Request handling), [`templates/index.html`](https://github.com/bikas-basnet/crop_abnormality_app/blob/main/templates/index.html) (Image upload form), [`model`](https://github.com/bikas-basnet/crop_abnormality_app/tree/main/model) (Crop model weights)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_webapp["Flask app<br/>[app.py]"]
  node_upload_form["Image upload form<br/>[index.html]"]
  node_request_handler["Request handling<br/>[app.py]"]
  node_language_ui["Bilingual interface<br/>[index.html]"]
end

subgraph group_diagnosis["Diagnosis pipeline"]
  node_image_prep["Image preprocessing<br/>[app.py]"]
  node_crop_verifier["Crop verification<br/>[app.py]"]
  node_crop_registry["Crop model configuration<br/>[app.py]"]
  node_crop_weights[("Crop model weights")]
  node_classifier["CNN classifiers<br/>[app.py]"]
  node_class_prediction["Abnormality prediction<br/>[app.py]"]
end

subgraph group_guidance["Results and guidance"]
  node_confidence["Confidence and severity<br/>[app.py]"]
  node_recommendations["Localized recommendations<br/>[app.py]"]
  node_results["Diagnosis results<br/>[index.html]"]
end

node_farmer(("Farmer"))

node_farmer -->|"submits image"| node_webapp
node_webapp -->|"renders"| node_upload_form
node_upload_form -->|"submits form"| node_request_handler
node_request_handler -->|"prepares image"| node_image_prep
node_request_handler -->|"checks crop"| node_crop_verifier
node_request_handler -->|"selects configuration"| node_crop_registry
node_crop_registry -->|"configures model paths"| node_crop_weights
node_request_handler -->|"loads classifier"| node_classifier
node_classifier -->|"predicts class"| node_class_prediction
node_request_handler -->|"computes severity"| node_confidence
node_request_handler -->|"selects advice"| node_recommendations
node_webapp -->|"renders diagnosis"| node_results
node_results -.->|"presents bilingually"| node_language_ui

click node_webapp "https://github.com/bikas-basnet/crop_abnormality_app/blob/main/app.py"
click node_upload_form "https://github.com/bikas-basnet/crop_abnormality_app/blob/main/templates/index.html"
click node_request_handler "https://github.com/bikas-basnet/crop_abnormality_app/blob/main/app.py"
click node_image_prep "https://github.com/bikas-basnet/crop_abnormality_app/blob/main/app.py"
click node_crop_verifier "https://github.com/bikas-basnet/crop_abnormality_app/blob/main/app.py"
click node_crop_registry "https://github.com/bikas-basnet/crop_abnormality_app/blob/main/app.py"
click node_crop_weights "https://github.com/bikas-basnet/crop_abnormality_app/tree/main/model"
click node_classifier "https://github.com/bikas-basnet/crop_abnormality_app/blob/main/app.py"
click node_class_prediction "https://github.com/bikas-basnet/crop_abnormality_app/blob/main/app.py"
click node_confidence "https://github.com/bikas-basnet/crop_abnormality_app/blob/main/app.py"
click node_recommendations "https://github.com/bikas-basnet/crop_abnormality_app/blob/main/app.py"
click node_results "https://github.com/bikas-basnet/crop_abnormality_app/blob/main/templates/index.html"
click node_language_ui "https://github.com/bikas-basnet/crop_abnormality_app/blob/main/templates/index.html"

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_webapp,node_upload_form,node_request_handler,node_language_ui toneBlue
class node_image_prep,node_crop_verifier,node_crop_registry,node_crop_weights,node_classifier,node_class_prediction toneAmber
class node_confidence,node_recommendations,node_results toneMint
class node_farmer toneIndigo
```

## Components

### Web experience

- [Flask app](https://github.com/bikas-basnet/crop_abnormality_app/blob/main/app.py): `app.py`
- [Image upload form](https://github.com/bikas-basnet/crop_abnormality_app/blob/main/templates/index.html): `templates/index.html`
- [Request handling](https://github.com/bikas-basnet/crop_abnormality_app/blob/main/app.py): `app.py`
- [Bilingual interface](https://github.com/bikas-basnet/crop_abnormality_app/blob/main/templates/index.html): `templates/index.html`

### Diagnosis pipeline

- [Image preprocessing](https://github.com/bikas-basnet/crop_abnormality_app/blob/main/app.py): `app.py`
- [Crop verification](https://github.com/bikas-basnet/crop_abnormality_app/blob/main/app.py): `app.py`
- [Crop model configuration](https://github.com/bikas-basnet/crop_abnormality_app/blob/main/app.py): `app.py`
- [Crop model weights](https://github.com/bikas-basnet/crop_abnormality_app/tree/main/model): `model`
- [CNN classifiers](https://github.com/bikas-basnet/crop_abnormality_app/blob/main/app.py): `app.py`
- [Abnormality prediction](https://github.com/bikas-basnet/crop_abnormality_app/blob/main/app.py): `app.py`

### Results and guidance

- [Confidence and severity](https://github.com/bikas-basnet/crop_abnormality_app/blob/main/app.py): `app.py`
- [Localized recommendations](https://github.com/bikas-basnet/crop_abnormality_app/blob/main/app.py): `app.py`
- [Diagnosis results](https://github.com/bikas-basnet/crop_abnormality_app/blob/main/templates/index.html): `templates/index.html`

### Other components

- **Farmer**

## Connections

- Farmer → Flask app: submits image (evidence: `README.md`)
- Flask app → Image upload form: renders (evidence: `app.py`)
- Image upload form → Request handling: submits form
- Request handling → Image preprocessing: prepares image (evidence: `app.py`)
- Request handling → Crop verification: checks crop (evidence: `app.py`)
- Request handling → Crop model configuration: selects configuration (evidence: `app.py`)
- Crop model configuration → Crop model weights: configures model paths (evidence: `app.py`)
- Request handling → CNN classifiers: loads classifier (evidence: `app.py`)
- CNN classifiers → Abnormality prediction: predicts class (evidence: `app.py`)
- Request handling → Confidence and severity: computes severity (evidence: `app.py`)
- Request handling → Localized recommendations: selects advice (evidence: `app.py`)
- Flask app → Diagnosis results: renders diagnosis (evidence: `app.py`)
- Diagnosis results → Bilingual interface: presents bilingually (evidence: `README.md`)
