# saipawar0272/crop-recommendation-app architecture

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

- Interactive diagram: https://gitdiagram.com/saipawar0272/crop-recommendation-app
- Repository: https://github.com/saipawar0272/crop-recommendation-app

## Overview

This is a Flask crop-recommendation application. A farmer submits environmental and soil values through the web interface; the Flask prediction route converts them to numeric features, calls the loaded classifier, and renders the predicted crop. A separate training script fits the classifier and saves the artifact used by the web app. The README also describes crop-input guidance and real-time weather integration, but those implementations were not sampled; those branches are therefore shown as unverified/documented capabilities.

Main entry points: [`app.py`](https://github.com/saipawar0272/crop-recommendation-app/blob/main/app.py) (Flask routes), [`templates/index.html`](https://github.com/saipawar0272/crop-recommendation-app/blob/main/templates/index.html) (Recommendation form), [`model.pkl`](https://github.com/saipawar0272/crop-recommendation-app/blob/main/model.pkl) (Crop classifier), [`model.py`](https://github.com/saipawar0272/crop-recommendation-app/blob/main/model.py) (Model training)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_flask["Flask routes<br/>[app.py]"]
  node_interface["Recommendation form<br/>[index.html]"]
  node_styles["Page styling<br/>[styles.css]"]
end

subgraph group_ml["Crop prediction"]
  node_classifier["Crop classifier<br/>[model.pkl]"]
  node_training["Model training<br/>[model.py]"]
end

subgraph group_guidance["Recommendation capabilities"]
  node_cropinfo["Crop details"]
  node_weather["Weather data"]
end

node_farmer(("Farmer"))

node_farmer -.->|"enters parameters"| node_interface
node_interface -.->|"submits form"| node_flask
node_flask -->|"renders page"| node_interface
node_flask -->|"loads model"| node_classifier
node_flask -->|"predicts crop"| node_classifier
node_flask -->|"renders result"| node_interface
node_training -->|"saves model"| node_classifier
node_flask -.->|"provides details"| node_cropinfo
node_weather -.->|"supplies conditions"| node_flask
node_interface -.->|"uses styling"| node_styles

click node_flask "https://github.com/saipawar0272/crop-recommendation-app/blob/main/app.py"
click node_interface "https://github.com/saipawar0272/crop-recommendation-app/blob/main/templates/index.html"
click node_styles "https://github.com/saipawar0272/crop-recommendation-app/blob/main/static/styles.css"
click node_classifier "https://github.com/saipawar0272/crop-recommendation-app/blob/main/model.pkl"
click node_training "https://github.com/saipawar0272/crop-recommendation-app/blob/main/model.py"
click node_cropinfo "https://github.com/saipawar0272/crop-recommendation-app/blob/main/templates/Crop_recommendation.csv"

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_flask,node_interface,node_styles toneBlue
class node_classifier,node_training toneAmber
class node_cropinfo,node_weather toneMint
class node_farmer toneIndigo
```

## Components

### Web application

- [Flask routes](https://github.com/saipawar0272/crop-recommendation-app/blob/main/app.py): `app.py`
- [Recommendation form](https://github.com/saipawar0272/crop-recommendation-app/blob/main/templates/index.html): `templates/index.html`
- [Page styling](https://github.com/saipawar0272/crop-recommendation-app/blob/main/static/styles.css): `static/styles.css`

### Crop prediction

- [Crop classifier](https://github.com/saipawar0272/crop-recommendation-app/blob/main/model.pkl): `model.pkl`
- [Model training](https://github.com/saipawar0272/crop-recommendation-app/blob/main/model.py): `model.py`

### Recommendation capabilities

- [Crop details](https://github.com/saipawar0272/crop-recommendation-app/blob/main/templates/Crop_recommendation.csv): `templates/Crop_recommendation.csv`
- **Weather data**

### Other components

- **Farmer**

## Connections

- Farmer → Recommendation form: enters parameters (evidence: `README.md`)
- Recommendation form → Flask routes: submits form (evidence: `README.md`)
- Flask routes → Recommendation form: renders page (evidence: `app.py`)
- Flask routes → Crop classifier: loads model (evidence: `app.py`)
- Flask routes → Crop classifier: predicts crop (evidence: `app.py`)
- Flask routes → Recommendation form: renders result (evidence: `app.py`)
- Model training → Crop classifier: saves model (evidence: `model.py`)
- Flask routes → Crop details: provides details (evidence: `README.md`)
- Weather data → Flask routes: supplies conditions (evidence: `README.md`)
- Recommendation form → Page styling: uses styling
