An intelligent web application for modern agriculture
Features • Installation • Usage • Project Structure • Contact
AgroAlly is a comprehensive agricultural intelligence platform designed to empower farmers and agricultural professionals with data-driven insights. The platform leverages agricultural datasets and simple machine-learning style logic to provide intelligent recommendations for crop selection, soil analysis, and disease detection.
This repository is structured and documented to be suitable for academic review (e.g. submission to a professor) and for demonstration in interviews or portfolios.
- Analyzes 7 key parameters: Nitrogen (N), Phosphorus (P), Potassium (K), Temperature, Humidity, pH, and Rainfall
- Uses Euclidean distance on a curated dataset to find the most similar crop conditions
- Provides recommendations in both English and Hindi using crop-name mapping
- Compares current soil parameters with optimal values for a target crop
- Highlights nutrient deficiencies or surpluses (N, P, K)
- Suggests fertilizer types and approximate application amounts (Urea, DAP, MOP)
- Adds general agronomic advice (pH correction, temperature, humidity, rainfall)
- Upload plant images for disease analysis
- Three analysis modes:
- Leaf Disease Detection
- Fruit Disease Detection
- Root Disease Detection
- Uses PyTorch
resnet18model when available, with a safe mock fallback when not - Provides human-readable treatment recommendations per plant and disease type
- Secure login and registration using hashed passwords
- Session-based authentication with Flask
- Per-user history of:
- Crop recommendations
- Soil analyses
- Disease analyses
- History is stored in SQLite and rendered in a readable JSON-like format
- Framework: Flask 3.0.0
- Language: Python 3.11
- Database: SQLite (development, academic demo)
- Authentication: Werkzeug password hashing
- Data Processing: Pandas, NumPy
- Framework: Bootstrap 5
- Languages: HTML5, CSS3, Jinja2 templates
- Icons: Font Awesome 6
- Design: Responsive, dashboard-style layout with sidebar navigation
- Framework: PyTorch (optional, for disease detection)
- Model: ResNet18-based classifier when model weights are available
- Fallback: Mock predictions with deterministic, user-friendly outputs
- Python 3.11 or higher
pip(Python package manager)- Git (for cloning repository)
git clone https://github.com/Shakya-kumar/agroweb.git
cd agroweb# Windows
python -m venv venv
venv\Scripts\activate
# Linux/Mac
python3 -m venv venv
source venv/bin/activatepip install -r requirements.txtpython app.pyThe application will be available at http://localhost:5000.
- Open
http://localhost:5000in your browser. - Click Register to create a new account.
- After registration you are automatically logged in and redirected to the dashboard.
- Dashboard: High-level entry point via login redirect.
- Crop Recommendation: Enter soil parameters and receive the most suitable crop suggestion.
- Soil Analysis: Provide a target crop and soil parameters for detailed nutrient and pH guidance.
- Disease Detection: Upload an image, select plant type and disease type (leaf/fruit/root) to get a prediction and treatment advice.
- History: View all your past analyses and recommendations.
- Contact & Reviews: Simple pages to demonstrate user feedback and contact details.
agroally/
├── app.py # Main Flask application (auth + features + APIs)
├── wsgi.py # WSGI entry point for production
├── requirements.txt # Python dependencies
├── runtime.txt # Python version specification (for deployment)
├── Procfile # Process file for deployment (Gunicorn/WSGI)
├── .gitignore # Git ignore rules
│
├── Crop_dataset.csv # Crop recommendation dataset
│
├── templates/ # Flask Jinja2 templates
│ ├── base.html # Base layout (sidebar, footer, etc.)
│ ├── login.html # Login page
│ ├── register.html # Registration page
│ ├── dashboard.html # User dashboard
│ ├── crop_recommendation.html
│ ├── crop_recommendations.html
│ ├── crop_result.html
│ ├── soil_analysis.html
│ ├── soil_analysis_result.html
│ ├── disease_analysis.html
│ ├── disease_result.html
│ ├── grow_crop.html
│ ├── view_history.html
│ ├── contact.html
│ ├── reviews.html
│ ├── 404.html # Error pages
│ └── 500.html
│
├── TESTING_GUIDE.md # (Optional) notes for deployment/testing
└── instance/ (auto-created at runtime)
└── users.db # SQLite database
Note: the repository has been cleaned to remove unused legacy files (old login.py and standalone SPA assets), keeping only what is necessary for a clean, professional academic submission.
| Method | Endpoint | Description |
|---|---|---|
| GET | / |
Redirects to login or dashboard |
| GET/POST | /login |
User authentication |
| GET/POST | /register |
User registration |
| GET | /dashboard |
User dashboard |
| GET/POST | /crop_recommendation |
Crop recommendation form + result |
| GET/POST | /soil_analysis |
Soil analysis form + result |
| GET | /disease_analysis |
Disease detection upload page |
| POST | /analyze_disease |
Process disease detection |
| GET | /history |
User history |
| GET | /logout |
User logout |
| Method | Endpoint | Description | Request Body |
|---|---|---|---|
| POST | /api/recommend |
Get crop recommendation | JSON with N, P, K, temperature, humidity, ph, rainfall |
| POST | /api/crop-requirements |
Get crop requirements | JSON with crop_name and soil parameters |
Example request:
curl -X POST http://localhost:5000/api/recommend \
-H "Content-Type: application/json" \
-d '{
"N": 90,
"P": 42,
"K": 43,
"temperature": 20.9,
"humidity": 82,
"ph": 6.5,
"rainfall": 202.9
}'Academic / project contact details used in the app:
- Address: 84 Kalpana Nagar, 2nd Floor, Bhopal
- Phone: +91 95890 02214
- Email:
support@agroally.com
For repository issues or suggestions, you can also open an issue on GitHub.
Built with ❤️ for Agriculture