AgriNex is an end-to-end, multi-modal agricultural intelligence platform leveraging machine learning, deep neural networks, and interactive web tools to empower modern precision farming. The system brings predictive analytics directly to farmers and agricultural extension workers through intuitive dashboards and live deployed microservices.
AgriNex combines cutting-edge AI/ML technologies with user-friendly web interfaces to help farmers make data-driven decisions about crop selection, disease management, and fertilizer optimization. The platform integrates multiple machine learning models trained on agricultural datasets to provide accurate and actionable insights.
- Overview
- Deployed Live Streamlit Applications
- System Architecture & Workflow
- Features
- Tech Stack
- Project Structure
- Getting Started
- Model Details
- Usage Examples
- Dataset Information
- Contributing
- License
AgriNex trained machine learning models are deployed live on Streamlit Cloud:
- πΎ Crop Recommendation AI: smart-crop-recommendations.streamlit.app
- π§ͺ Fertilizer Prediction AI: fertilizer-predictions.streamlit.app
- π¬ Plant Disease Identification: plant-diseases-identification.streamlit.app
graph TD
User([Farmer / Agricultural Worker]) --> WebApp[AgriSens Web Application]
subgraph Frontend Layer
WebApp --> CropPage[Crop Recommendation UI]
WebApp --> FertPage[Fertilizer Advisor UI]
WebApp --> DiseasePage[Disease Detection UI]
WebApp --> Chatbot[AI Kisan Chatbot Widget]
WebApp --> Dashboard[Farm Dashboard & Mandi Ticker]
end
subgraph ML & Intelligence Layer
CropPage --> |Soil & Climate Data| CropML[Random Forest Classifier]
FertPage --> |Soil Nutrient Analysis| FertML[Fertilizer XGB/RF Classifier]
DiseasePage --> |Leaf Image Upload| DiseaseCNN[TensorFlow 38-Class CNN Model]
Chatbot --> |Natural Language Query| KisanEngine[Knowledge Engine & Mandi Data API]
end
subgraph External Cloud Deployments
CropML --> StreamlitCloud[Streamlit Cloud Services]
FertML --> StreamlitCloud
DiseaseCNN --> StreamlitCloud
end
- Embedded Streamlit ML Apps: Real-time interactive model predictions seamlessly embedded inside responsive web interfaces (
crop-prediction.html,fertilizer.html,disease-detection.html). - Universal AI Kisan Chatbot: Multi-lingual floating conversational assistant tailored for localized agricultural advice, weather alerts, disease remedies, and APMC market prices.
- Precision Crop Recommendation Engine: High-accuracy crop selection powered by Random Forest algorithms analyzing Nitrogen (N), Phosphorus (P), Potassium (K), temperature, relative humidity, pH, and annual rainfall.
- Computer Vision Plant Pathology: Deep convolutional neural network (CNN) capable of identifying 38 distinct crop diseases across 14 plant species with leaf image uploaded via web interface.
- Soil-Specific Fertilizer Advisor: Automated fertilizer dosage calculation matching crop requirements against current NPK depletion metrics to avoid over-fertilization.
- Live APMC Mandi Ticker & Government Schemes: Real-time wholesale commodity price ticker and curated catalog of PM-KISAN, KCC, and state agricultural subsidies.
- Farm Management Telemetry Dashboard: Complete farm monitoring hub with 7-day weather forecasting, spray-window advisory, yield revenue estimate tools, and direct Krishi Vigyan Kendra (KVK) contacts.
- React.js - Interactive user interface
- HTML/CSS/JavaScript - Web standards
- Python - Core language for ML/AI services
- Streamlit - Framework for data apps and model serving
- Flask - Web framework for APIs
- TensorFlow - Deep learning framework
- Keras - Neural network API for plant disease identification
- scikit-learn - Machine learning algorithms for crop and fertilizer prediction
- Random Forest Classifier - Ensemble learning for crop recommendation
- Pandas - Data manipulation and analysis
- NumPy - Numerical computing
- Matplotlib - 2D plotting and visualization
- Seaborn - Statistical data visualization
- OpenCV - Computer vision for image processing
- PlantVillage Dataset - 38 plant disease classes
- Crop Recommendation Dataset - Soil and environmental parameters
- Fertilizer Recommendation Dataset - Soil nutrient analysis
AgriNex/
βββ CROP PREDICT/ # React frontend + ML model training
β βββ frontend/ # React application
β β βββ public/
β β β βββ index.html
β β β βββ manifest.json
β β βββ src/
β β βββ App.js
β β βββ home.js
β β βββ index.js
β β βββ index.css
β βββ saved_model/ # Pre-trained crop prediction models
β β βββ model_v1.h5
β β βββ model_v2.h5
β β βββ model_v3.h5
β βββ training/
β βββ model.ipynb # Model training notebook
β βββ PlantVillage/ # Training dataset
β
βββ CROP-RECOMMENDATION/ # Streamlit crop recommendation app
β βββ webapp.py # Main Streamlit application
β βββ Crop_recommendation.csv # Dataset
β βββ requirements.txt
β βββ fgd.html
β
βββ PLANT-DISEASE-IDENTIFICATION/ # Streamlit disease detection app
β βββ main.py # Main Streamlit application
β βββ trained_plant_disease_model.keras # Trained Keras model
β βββ Train_plant_disease.ipynb # Training notebook
β βββ Test_plant_disease.ipynb # Testing notebook
β βββ training_hist.json # Training history
β βββ settings.json # Configuration
β βββ requirements.txt
β βββ test/ # Test images
β
βββ fertilizer_prediction/ # Fertilizer prediction module
β βββ fertilizer_prediction/
β βββ fert.py # Fertilizer prediction script
β βββ p1.ipynb # Analysis notebook
β βββ data_core.csv # Dataset
β βββ requirements.txt
β
βββ Datasets/ # Consolidated datasets
β βββ Crop_recommendation.csv
β βββ Fertilizer_recommendation.csv
β βββ README.md
β βββ PlantVillage/ # Plant disease images
β βββ Potato___healthy/
β βββ Potato___Late_blight/
β βββ [38+ disease classes]
β
βββ AgriSens-web-app/ # Integrated web application
- Python 3.8+
- Node.js 14+ (for frontend web apps)
- Docker & Docker Compose (optional for containerized setup)
pip/venvorcondafor environment isolation- Git
git clone https://github.com/SQUADRON-LEADER/AgriNex.git
cd AgriNex# Create and activate virtual environment
python -m venv venv
# On Windows
.\venv\Scripts\activate
# On Linux/macOS
source venv/bin/activatecd CROP-RECOMMENDATION
pip install -r requirements.txt
streamlit run webapp.pyAccess interface at http://localhost:8501
cd ../PLANT-DISEASE-IDENTIFICATION
pip install -r requirements.txt
streamlit run main.py --server.port 8502Access interface at http://localhost:8502
cd ../fertilizer_prediction/fertilizer_prediction
pip install -r requirements.txt
python fert.pycd ../AgriSens-web-app
# Open index.html directly in browser or serve via npx http-server
npx http-server -p 8080# Build and run containers via Docker Compose
docker-compose up --build -d- Algorithm: Random Forest Classifier
- Features: N, P, K (soil nutrients), Temperature, Humidity, pH, Rainfall
- Output Classes: 22 different crops (Rice, Maize, Chickpea, Kidney Beans, Pigeon Peas, Moth Beans, Mung Bean, Black Gram, Lentil, Pomegranate, Banana, Mango, Grapes, Watermelon, Muskmelon, Apple, Orange, Papaya, Coconut, Cotton, Jute, Coffee)
- Accuracy: ~99% cross-validation accuracy
- Training Data: 2,200+ soil & climate sample observations
| Feature Parameter | Symbol | Measurement Unit | Typical Value Range | Description |
|---|---|---|---|---|
| Nitrogen | N |
ratio / mg/kg | 0 - 140 | Soil ratio of Nitrogen content |
| Phosphorus | P |
ratio / mg/kg | 5 - 145 | Soil ratio of Phosphorus content |
| Potassium | K |
ratio / mg/kg | 5 - 205 | Soil ratio of Potassium content |
| Temperature | temp |
Β°C | 8.8 - 43.7 | Ambient atmospheric temperature |
| Humidity | humidity |
% | 14.3 - 99.9 | Relative air humidity percentage |
| pH Level | ph |
pH scale | 3.5 - 9.9 | Acidity / alkalinity index of soil |
| Rainfall | rainfall |
mm | 20.2 - 298.6 | Cumulative seasonal rainfall |
- Framework: TensorFlow / Keras 2.x
- Architecture: Convolutional Neural Network (CNN) with Softmax classification layer
- Input Dimensions: 128x128 pixel RGB tensor
- Output Classes: 38 distinct plant pathology classes
- Supported Crops: Apple, Blueberry, Cherry, Corn, Grape, Orange, Peach, Pepper, Potato, Raspberry, Soybean, Squash, Strawberry, Tomato
- Algorithm: Machine Learning Classifier (Random Forest / XGBoost hybrid)
- Features: Soil NPK baseline, soil type, crop type, humidity, temperature
- Output: Optimized target fertilizer blend (e.g., Urea, DAP, 14-35-14, 28-28, 17-17-17, 20-20, 10-26-26) with calculated application rate
Input: N=90, P=42, K=43, Temperature=20.87, Humidity=82.00, pH=6.5, Rainfall=202.9
Output: Recommendation for "Maize" cropInput: Plant leaf image
Output: Disease identified with confidence score
Example: "Potato___Late_blight - 95% confidence"Input: Soil parameters and crop type
Output: Specific fertilizer recommendation with dosage- PlantVillage Dataset: 61,486 images across 38 disease classes
- Crop Dataset: Features covering 22 different crops with environmental parameters
- Fertilizer Dataset: Comprehensive soil and crop parameters with recommendations
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
To retrain or evaluate models:
cd CROP\ PREDICT/training
jupyter notebook model.ipynbcd PLANT-DISEASE-IDENTIFICATION
jupyter notebook Train_plant_disease.ipynbEach service has a settings.json or configuration file for model parameters and settings. Modify these files to adjust:
- Model paths
- Input parameters
- Output formats
- Service ports
See individual requirements.txt files in each module directory for specific dependencies:
- Core ML dependencies: TensorFlow, Keras, scikit-learn
- Data processing: Pandas, NumPy
- Visualization: Matplotlib, Seaborn
- Web frameworks: Streamlit, Flask
- Image processing: OpenCV, Pillow
- Ensure model files (.keras, .h5) are in the correct directories
- Verify TensorFlow and Keras versions match training environment
streamlit run app.py --server.port 8503pip install --upgrade -r requirements.txtThis project is licensed under the MIT License - see the LICENSE file for details.
AgriNex is developed as an agricultural AI solution combining expertise in:
- Machine Learning & Deep Learning
- Agricultural Science
- Full-Stack Web Development
For issues, questions, or suggestions:
- Open an issue on GitHub
- Check existing documentation
- Review dataset README files for data-specific questions
- Multi-modal Web Dashboard Integration: Unified interface for crop recommendation, disease detection, and fertilizer calculation.
- Live Streamlit Cloud Deployment: Microservices published live for testing and remote inference.
- Hyper-local Weather & Microclimate API: Integrate OpenWeatherMap API for live rainfall and moisture forecast alerts.
- Real-time Commodity Price Forecasting: Time-series predictive models for APMC market trends.
- Native Mobile Application (React Native): Offline-first mobile app for field operation with localized camera scan.
- Regional Language Localization: Support for Hindi, Marathi, Punjabi, Tamil, Telugu, and Kannada.
- IoT Sensor Grid Integration: Direct Bluetooth / LoRaWAN telemetry ingestion from soil NPK hardware probes.
AgriNex β’ Empowering Sustainable Farming with Artificial Intelligence
Developed with β€οΈ for farmers, agronomists, and precision agriculture worldwide.