Skip to content

Latest commit

ย 

History

55 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŒฑ CultivaSense - Smart Crop Recommendation System

Python Flask Machine Learning AI Powered License: MIT Contributions Welcome

CultivaSense is a comprehensive AI-powered agricultural intelligence platform designed specifically for Indian agriculture. Using advanced machine learning algorithms and computer vision, it provides farmers with data-driven insights including crop recommendations, disease detection, and market price predictions to maximize yield and promote sustainable farming practices.

๐ŸŽฌ Demo Video

Watch the Demo

๐ŸŽฅ โ–ถ Watch the full demo on YouTube โ€” See CultivaSense in action: Smart Farming Using AI & Machine Learning

โœจ Features

๐Ÿง  Smart Crop Recommendation

  • 95% Accuracy in crop recommendations using Random Forest Classifier
  • 22 Different Crops analyzed and supported (Rice, Wheat, Maize, Cotton, and more)
  • Real-time soil condition analysis with 7 environmental parameters
  • Personalized suggestions based on NPK levels, pH, temperature, humidity, and rainfall
  • Instant comparison between your soil values and ideal conditions

๐Ÿ”ฌ Crop Disease Detection

  • Computer Vision-based disease identification from crop images
  • Supports 32 disease classes across major crops (Apple, Corn, Grape, Potato, Rice, Tomato, Wheat)
  • Instant diagnosis with confidence scores
  • Detailed treatment recommendations for each detected disease
  • Image upload with preview (supports JPG, PNG up to 5MB)
  • Covers diseases like:
    • Rice: Brown Spot, Leaf Blast, Neck Blast
    • Wheat: Brown Rust, Yellow Rust
    • Tomato: Early Blight, Late Blight, Leaf Mold, Bacterial Spot, and more
    • Potato, Corn, Apple, Grape diseases

๐Ÿ’ฐ Market Price Prediction

  • AI-powered price forecasting using Random Forest Regressor
  • Predictions for 8 major crop categories (Rice, Wheat, Maize, Cotton, Sugarcane, Pulses, Vegetables, Fruits)
  • 13 Indian states coverage (Maharashtra, Punjab, Haryana, UP, Bihar, and more)
  • Seasonal analysis with month-wise predictions
  • Weather-based market trend insights
  • Factors considered: Crop type, State, Month, Rainfall, Temperature

๐Ÿงช Comprehensive Soil Testing

  • NPK Analysis (Nitrogen, Phosphorus, Potassium)
  • pH Level monitoring and recommendations
  • Nutrient Deficiency detection with interactive recovery plans
  • Environmental factor analysis (temperature, humidity, rainfall)
  • Visual comparison charts (Your values vs Ideal values)

๐ŸŒฑ Interactive Recovery Solutions

  • Instant access to detailed recovery plans for each nutrient
  • Specific fertilizer recommendations with dosages
  • Application schedules and timing guidance
  • Separate plans for deficiency and excess conditions
  • Covers all parameters: N, P, K, pH, Temperature, Humidity, Rainfall

๐Ÿ“Š Modern User Interface

  • Mobile-responsive design with glassmorphism effects
  • Dark mode optimized interface
  • Interactive animations and smooth transitions
  • Real-time validation with helpful error messages
  • Sample data loading for quick testing
  • Accessibility features with ARIA labels

๐Ÿ’ฐ Financial Planning & ROI Calculator

  • Real-time ROI analysis for crop profitability planning
  • Input land area, expected yield, selling price, and cost breakdown
  • Calculates Total Investment, Revenue, Net Profit, and ROI %
  • Break-even yield analysis to understand minimum viable production
  • Risk assessment with color-coded indicators (Highly Profitable โ†’ High Risk)
  • Smart tips for improving profitability (cost optimization, scaling advice)
  • Supports per-acre cost breakdown: Seeds, Fertilizer, Labor, Miscellaneous

๐Ÿค– AI Agricultural Advisor

  • Powered by Google Gemini 2.0 Flash
  • Real-time interaction with a specialized agricultural AI
  • Personalized advice based on your local weather and soil conditions
  • Location-aware responses (using GPS coordinates)
  • Conversational interface for natural farming queries

๐Ÿ—๏ธ System Architecture

graph TB
    subgraph User Interface
        A["๐ŸŒ Web Browser"]
    end

    subgraph Flask Backend
        B["โš™๏ธ Flask App (app.py)"]
    end

    subgraph ML Models
        C["๐Ÿง  Crop Recommendation<br/>Random Forest Classifier"]
        D["๐Ÿ”ฌ Disease Detection<br/>Computer Vision + CSV"]
        E["๐Ÿ’ฐ Price Prediction<br/>Random Forest Regressor"]
    end

    subgraph External APIs
        F["๐Ÿค– Google Gemini API<br/>AI Chatbot"]
        G["๐ŸŒค๏ธ OpenWeather API<br/>Weather Data"]
    end

    subgraph Data Layer
        H["๐Ÿ“Š Crop_recommendation.csv"]
        I["๐Ÿฆ  Crop_Disease.csv"]
        J["๐Ÿ“ˆ market_price_data.csv"]
    end

    A -->|HTTP Requests| B
    B --> C
    B --> D
    B --> E
    B --> F
    B --> G
    C --> H
    D --> I
    E --> J
Loading

๐Ÿš€ Quick Start

Prerequisites

  • Python 3.8 or higher
  • pip package manager
  • Modern web browser
  • (Optional) TensorFlow for disease detection model

Installation

  1. Clone the repository

    git clone https://github.com/dasouvik122005/Cultiva-Sense.git
    cd Cultiva-Sense
  2. Create virtual environment

    python -m venv .venv
    source .venv/bin/activate  # On Windows: .venv\Scripts\activate
  3. Install dependencies

    pip install -r requirements.txt
  4. Set up environment variables

    cp .env.example .env
    # Edit .env file with your API keys

    Required Keys:

  5. Run the application

    python app.py
  6. Open in browser Navigate to http://127.0.0.1:5000

๐ŸŽฏ Usage

1. Crop Recommendation

  • Navigate to the "Soil Analyzer" section
  • Enter soil nutrient values (N, P, K)
  • Input environmental conditions (temperature, humidity, pH, rainfall)
  • Click "Analyze Soil" for instant crop recommendations
  • View nutrient comparison and recovery plans

2. Disease Detection

  • Go to the "Crop Disease Detection" section
  • Upload a clear image of the affected crop (JPG/PNG, max 5MB)
  • Click "Detect Disease" for instant diagnosis
  • View disease name, confidence score, and treatment recommendations

3. Market Price Prediction

  • Navigate to "Market Price Prediction" section
  • Select crop type and state
  • Choose month and enter weather conditions
  • Click "Predict Price" for market forecasts
  • View predicted price and market trend analysis

4. Financial Planning & ROI

  • Scroll to the "Financial Planning & ROI" section
  • Enter your land area (acres), expected yield (kg/acre), and selling price (โ‚น/kg)
  • Fill in per-acre costs: Seeds, Fertilizer, Labor, Other
  • Click "Calculate ROI" to see your full profitability analysis
  • Review Net Profit, ROI %, break-even yield, and smart tips

๐Ÿ“ Project Structure

Cultiva-Sense/
โ”‚
โ”œโ”€โ”€ ๐Ÿ“„ app.py                          # Main Flask application with all routes
โ”œโ”€โ”€ ๐Ÿ“„ config.py                       # Configuration management
โ”œโ”€โ”€ ๐Ÿ“„ setup.py                        # Project setup script
โ”œโ”€โ”€ ๐Ÿ“„ requirements.txt                # Python dependencies
โ”œโ”€โ”€ ๐Ÿ“„ .env.example                    # Environment variables template
โ”‚
โ”œโ”€โ”€ ๐Ÿ“Š Models & Data
โ”‚   โ”œโ”€โ”€ model.pkl                      # Trained crop recommendation model
โ”‚   โ”œโ”€โ”€ minmaxscaler.pkl               # Feature scaling model
โ”‚   โ”œโ”€โ”€ Crop_recommendation.csv        # Training dataset
โ”‚   โ”œโ”€โ”€ Crop_Disease.csv               # Disease detection database
โ”‚   โ”œโ”€โ”€ market_price_data.csv          # Market price historical data
โ”‚   โ””โ”€โ”€ models/
โ”‚       โ”œโ”€โ”€ plant_disease_model.h5     # CNN model for disease detection (optional)
โ”‚       โ”œโ”€โ”€ market_price_model.pkl     # Price prediction model
โ”‚       โ”œโ”€โ”€ price_scaler.pkl           # Price feature scaler
โ”‚       โ”œโ”€โ”€ disease_classes.json       # Disease class mappings
โ”‚       โ””โ”€โ”€ price_model_info.json      # Price model metadata
โ”‚
โ”œโ”€โ”€ ๐Ÿ“ static/
โ”‚   โ”œโ”€โ”€ ๐ŸŽจ style.css                   # Modern responsive styling
โ”‚   โ”œโ”€โ”€ โšก script.js                    # Interactive functionality
โ”‚   โ””โ”€โ”€ ๐Ÿ–ผ๏ธ logo.png                    # Brand logo
โ”‚
โ”œโ”€โ”€ ๐Ÿ“ templates/
โ”‚   โ””โ”€โ”€ ๐ŸŒ index.html                  # Main web interface
โ”‚
โ”œโ”€โ”€ ๐Ÿ“ uploads/                        # Temporary storage for uploaded images
โ”‚
โ”œโ”€โ”€ ๐Ÿ› ๏ธ Utilities
โ”‚   โ”œโ”€โ”€ generate_disease_data.py       # Generate disease dataset
โ”‚   โ”œโ”€โ”€ generate_market_price_data.py  # Generate price dataset
โ”‚
โ”œโ”€โ”€ ๐Ÿ““ Crop Classification...ipynb      # Jupyter notebook for model training
โ”œโ”€โ”€ ๐Ÿ“„ CONTRIBUTING.md                  # Contribution guidelines
โ”œโ”€โ”€ ๐Ÿ“„ CODE_OF_CONDUCT.md               # Code of conduct
โ”œโ”€โ”€ ๐Ÿ“„ SECURITY.md                      # Security policy
โ””โ”€โ”€ ๐Ÿ“„ README.md                        # Project documentation

๐Ÿ› ๏ธ Technology Stack

Backend

  • Flask 2.3.3 - Lightweight web framework
  • Python 3.8+ - Core programming language
  • Scikit-learn 1.3.0 - Machine learning library
  • Pandas 2.0.3 - Data manipulation and analysis
  • NumPy 1.24.3 - Numerical computing
  • Pillow - Image processing for disease detection
  • h5py - HDF5 file handling
  • Google Gemini API - AI-powered conversational advisor
  • Gunicorn - Production WSGI server

Frontend

  • HTML5 - Modern semantic markup
  • CSS3 - Responsive design with glassmorphism effects
  • JavaScript (Vanilla) - Interactive user experience
  • Responsive Design - Mobile-first approach
  • Accessibility - ARIA labels and semantic HTML

Machine Learning

  • Random Forest Classifier - Crop recommendation (95% accuracy)
  • Random Forest Regressor - Market price prediction
  • Computer Vision - Image-based disease detection
  • Min-Max Scaling - Feature normalization
  • Cross-validation - Model performance optimization

Optional

  • TensorFlow/Keras - Deep learning for advanced disease detection
  • CNN (Convolutional Neural Network) - Image classification

๐ŸŒพ Supported Crops

CultivaSense provides recommendations for 22 major Indian crops:

๐ŸŒพ Cereals: Rice, Wheat, Maize, Barley
๐Ÿซ˜ Legumes: Chickpea, Kidney Beans, Pigeon Peas, Moth Beans, Mung Bean, Black Gram, Lentil
๐Ÿฅฅ Plantation: Coconut, Coffee
๐ŸŽ Fruits: Apple, Banana, Grapes, Orange, Papaya, Pomegranate, Watermelon, Muskmelon
๐ŸŒฑ Cash Crops: Cotton, Jute

๐Ÿ“Š Model Performance

Crop Recommendation System

  • Accuracy: 95%+ on validation dataset
  • Training Data: 2,200+ soil samples
  • Features: 7 soil and environmental parameters (N, P, K, Temperature, Humidity, pH, Rainfall)
  • Algorithm: Random Forest Classifier
  • Validation: K-fold cross-validation
  • Optimization: Grid search hyperparameter tuning

Disease Detection System

  • Disease Classes: 32 different diseases
  • Supported Crops: 7 major crops (Apple, Corn, Grape, Potato, Rice, Tomato, Wheat)
  • Detection Method: Computer Vision + CSV-based matching
  • Image Support: JPG, PNG (up to 5MB)
  • Features: Color analysis, affected area detection
  • Treatment Database: Comprehensive recommendations for each disease

Market Price Prediction

  • Crop Categories: 8 major categories
  • Geographic Coverage: 13 Indian states
  • Algorithm: Random Forest Regressor
  • Features: Crop ID, State ID, Month, Rainfall, Temperature
  • Feature Importance: Crop type (78.8%), Temperature (7.3%), Month (5.2%), Rainfall (5.3%), State (3.4%)
  • Seasonal Analysis: Month-wise trend predictions
  • Market Insights: Weather-based trend analysis

๐ŸŒ Environmental Impact

Sustainable Agriculture Goals:

  • ๐ŸŒฟ Promote eco-friendly farming practices
  • ๐Ÿ’ง Optimize water usage through smart recommendations
  • ๐ŸŒฑ Reduce chemical fertilizer dependency
  • ๐Ÿ“ˆ Increase crop yield efficiency
  • ๐ŸŒพ Support biodiversity in agricultural systems

๐Ÿ“ฑ Mobile Responsiveness

CultivaSense is designed with a mobile-first approach:

  • โœ… Fully Responsive - Works on all screen sizes
  • โœ… Touch-Friendly - Optimized for mobile interactions
  • โœ… Fast Loading - Optimized performance
  • โœ… Progressive Web App - App-like experience

๐Ÿค Contributing

We welcome contributions to make CultivaSense even better!

Please read our Contribution Guidelines and Code of Conduct before contributing.

How to Contribute:

  1. Fork the repository
  2. Create feature branch (git checkout -b feature/amazing-feature)
  3. Commit changes (git commit -m 'Add amazing feature')
  4. Push to branch (git push origin feature/amazing-feature)
  5. Open Pull Request

Areas for Contribution:

  • ๐ŸŒพ Additional crop support
  • ๐Ÿง  Model accuracy improvements
  • ๐ŸŽจ UI/UX enhancements
  • ๐ŸŒ Localization support
  • ๐Ÿ“ฑ Mobile app development

๐Ÿ” Security

For security concerns, please review our Security Policy.

๐Ÿ™ Acknowledgments

  • Indian Agricultural Research Institute - Dataset and domain expertise
  • Scikit-learn Community - Machine learning framework
  • Flask Team - Web framework development
  • Agricultural Experts - Domain knowledge and validation

๐Ÿ”ฎ Future Roadmap

Version 2.0 - Planned Features:

  • ๐Ÿ›ฐ๏ธ Satellite Imagery - Remote sensing capabilities for field analysis
  • ๐Ÿ“Š Advanced Analytics Dashboard - Historical tracking and trend analysis
  • ๐ŸŒ Multi-language Support - Hindi, Tamil, Telugu, Bengali, and other regional languages
  • ๐Ÿ“ฑ Progressive Web App - Offline capability and app-like experience
  • ๐Ÿ’พ User Accounts - Save predictions and track farming history
  • ๐Ÿ“ง Email Reports - Automated PDF reports via email

Version 3.0 - Vision:

  • ๐ŸŒพ Advanced Disease Detection - Deep learning CNN model with 98%+ accuracy
  • ๐ŸŽฏ Precision Farming - GPS-guided field-specific recommendations
  • ๐Ÿ“ก IoT Integration - Smart sensor connectivity for real-time monitoring
  • ๐Ÿ“ˆ Yield Prediction - AI-powered harvest forecasting
  • ๐ŸŒ Community Platform - Farmer forums and knowledge sharing
  • ๐Ÿช Marketplace Integration - Direct buyer-seller connections
  • ๐Ÿ“ฑ Native Mobile Apps - iOS and Android applications

โœ… Recently Implemented (Current Version):

  • โœ… Crop Disease Detection with 32 disease classes
  • โœ… Market Price Prediction for 8 crop categories across 13 states
  • โœ… Interactive Recovery Plans for all soil parameters
  • โœ… Mobile-responsive modern UI with glassmorphism design
  • โœ… Computer Vision-based disease analysis
  • โœ… Seasonal market trend analysis
  • โœ… Weather API Integration (OpenWeatherMap)
  • โœ… AI Chatbot powered by Google Gemini 2.0 Flash
  • โœ… Financial Planning & ROI Calculator with profitability analysis

๐Ÿ“ˆ Statistics

  • โญ 95% Model Accuracy (Crop Recommendation)
  • ๐ŸŒพ 22 Supported Crops
  • ๐Ÿ”ฌ 32 Disease Classes Detected
  • ๐Ÿ’ฐ 8 Crop Categories for Price Prediction
  • ๐Ÿ—บ๏ธ 13 Indian States Coverage
  • ๐Ÿ“Š 2,200+ Training Samples
  • ๐Ÿ‡ฎ๐Ÿ‡ณ Pan-India Coverage
  • ๐Ÿ“ฑ 100% Mobile Responsive

๐Ÿ‘ฅ Team

Name GitHub
Souvik Das @dasouvik122005
Soaham Behera @SoahamBehera
Surajit Das @surajitdas-gif
Nandini Verma @nandiniverma29

๐ŸŒฑ Empowering Indian Agriculture with AI ๐Ÿค–

Built with โค๏ธ for sustainable farming and food security

Five Powerful Features:
๐Ÿง  Crop Recommendation | ๐Ÿ”ฌ Disease Detection | ๐Ÿ’ฐ Price Prediction | ๐Ÿ“Š ROI Calculator | ๐Ÿค– AI Advisor


๐Ÿ“ง Contact: dasouvik122005@gmail.com


ยฉ 2026 CultivaSense. All rights reserved. | Built for Indian Agriculture ๐Ÿ‡ฎ๐Ÿ‡ณ

About

Smart Agricultural system based on Machine Learning.

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages