Skip to content

AgriTech is an AI-powered web platform that offers crop recommendations, yield prediction, disease detection, and collaborative tools to empower farmers and promote smart, sustainable agriculture.

License

Notifications You must be signed in to change notification settings

omroy07/AgriTech

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1,557 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

🌱 AgriTech β€” Smart Farming Solutions

AgriTech Banner

SWoC 2026 License: MIT PRs Welcome


πŸ“š Table of Contents


⚠️ Note: For production deployment, use a WSGI server like gunicorn instead of Flask's built-in server.

⚠️ Never commit your .env file or API keys to the repository. Always keep secrets private!


AgriTech is an AI-powered smart agriculture platform designed to assist farmers with crop recommendations, yield prediction, plant disease detection, and community-driven collaborationβ€”enabling sustainable and data-driven farming practices.


πŸ“Œ Overview

  • AI-driven decision support for modern agriculture
  • Early-stage plant disease detection
  • Crop yield forecasting using machine learning models
  • Collaborative ecosystem for farmers and stakeholders

πŸš€ Quick Start

1️⃣ Clone the Repository

git clone https://github.com/omroy07/AgriTech.git
cd AgriTech

2️⃣ Run Backend (Primary – Flask)

pip install -r requirements.txt
python app.py

Backend URL:

http://localhost:5000

πŸ” Backend Health Check

GET http://localhost:5000/health

Expected response:

{ "status": "ok" }

3️⃣ Run Frontend

cd src/frontend
python -m http.server 8000

Frontend URL:

http://localhost:8000

Note: Backend and frontend must be running simultaneously for proper functionality.


πŸ–₯️ Application Preview

AgriTech Dashboard AgriTech Dashboard

AgriTech Dashboard AgriTech Dashboard


πŸ—οΈ System Architecture

  1. User Input: Soil data and plant images
  2. Backend Processing: Flask APIs and model routing
  3. ML Inference:
    • CNNs for disease detection
    • Random Forest / XGBoost for crop recommendation
    • Regression models for yield prediction
  4. Output: Predictions with insights and actions

🌟 Core Features

  • 🌾 Crop Recommendation
  • πŸ“‰ Yield Prediction
  • πŸ”¬ Disease Detection
  • οΏ½ AI Chatbot - Platform guidance & agriculture support
  • �🀝 Farmer Community
  • πŸ›’ Shopkeeper Listings

πŸ€– AI Chatbot

AgriTech's AI-powered chatbot provides comprehensive support for farmers:

Features

  • Platform Guidance: Explains how to use all AgriTech features and tools
  • Agriculture Support: Answers farming questions, crop recommendations, pest control
  • Decision Making: Provides region-specific, season-based farming advice
  • Image Analysis: Upload plant photos for disease detection and diagnosis
  • 24/7 Support: Always available for instant farming assistance

Technical Implementation

  • Dual Mode: AI-powered (Google Gemini) + Rule-based fallback
  • Smart Matching: Fuzzy search with keyword analysis for accurate responses
  • Offline Capability: Works without internet using JSON-based responses
  • Image Processing: Analyzes plant photos for disease identification

Usage

# Start the chatbot server
npm install
node server.js

# Access at: http://localhost:3000/chat

API Endpoints

  • POST /api/chat - Send messages and images for AI analysis

πŸ› οΈ Tech Stack

🎨 Frontend

  • HTML5
  • CSS3
  • JavaScript (ES6)

βš™οΈ Backend

  • Python (Flask)
  • Node.js (Optional)

πŸ€– Machine Learning

  • TensorFlow
  • Scikit-learn
  • OpenCV

πŸ—„οΈ Database & DevOps

  • MySQL
  • MongoDB
  • Firebase
  • Docker
  • GitHub Actions

πŸ“‚ Project Structure

AGRITECH/
β”œβ”€β”€ app.py                      # 🐍 Flask Backend (Main entry point)
β”œβ”€β”€ server.js                   # 🟒 Node.js Chatbot Server
β”œβ”€β”€ package.json                # Node.js dependencies
β”œβ”€β”€ requirements.txt            # Python dependencies
β”œβ”€β”€ firebase.js                 # Firebase config fetching
β”œβ”€β”€ πŸ“ chatbot/
β”‚   β”œβ”€β”€ chat.html               # πŸ€– Chatbot interface
β”‚   β”œβ”€β”€ chat.js                 # Chatbot client logic
β”‚   β”œβ”€β”€ chat.css                # Chatbot styling
β”‚   β”œβ”€β”€ json-chatbot.js         # Rule-based chatbot engine
β”‚   └── chatbot-responses.json  # Predefined responses
β”œβ”€β”€ πŸ“ src/
β”‚   └── πŸ“ frontend/            # 🌐 Frontend UI (HTML, CSS, JS)
β”‚       β”œβ”€β”€ πŸ“ pages/           # Individual page files
β”‚       β”œβ”€β”€ πŸ“ css/             # Stylesheets
β”‚       └── πŸ“ js/              # Client-side scripts
β”œβ”€β”€ πŸ“ Crop Recommendation/   # 🌾 Crop recommendation module
β”œβ”€β”€ πŸ“ Disease Prediction/     # πŸ”¬ Disease detection module
β”œβ”€β”€ πŸ“ Crop Yield Prediction/   # πŸ“Š Yield forecasting module
β”œβ”€β”€ πŸ“ Community/               # πŸ’¬ community/forum backend
β”œβ”€β”€ πŸ“ images/                  # πŸ“Έ Screenshots and assets
β”œβ”€β”€ πŸ“„ README.md                # This file
└── πŸ“„ CONTRIBUTING.md          # Contribution guidelines

Backend vs Frontend

  • Backend (app.py at root): Flask server handling APIs, Firebase config
  • Frontend (src/frontend/): Static HTML/CSS/JS served via Python HTTP server
  • Optional Node Server (server.js): Alternative chat backend (not required)

πŸ” Security & Reliability

  • Image sanitization using OpenCV
  • Secrets stored in .env files
  • ML models evaluated using standard performance metrics (accuracy varies by model and dataset)

βš™οΈ Environment Variables

GEMINI_API_KEY=your_api_key
FIREBASE_API_KEY=your_key
FIREBASE_AUTH_DOMAIN=your_project.firebaseapp.com
FIREBASE_PROJECT_ID=your_project_id
FIREBASE_STORAGE_BUCKET=your_bucket.appspot.com
FIREBASE_MESSAGING_SENDER_ID=your_sender_id
FIREBASE_APP_ID=your_app_id
FIREBASE_MEASUREMENT_ID=your_measurement_id

πŸ›£οΈ Roadmap

  • Cloud Deployment
  • Mobile Application
  • Real-Time Weather API
  • AI Chatbot βœ… COMPLETED
  • Multilingual Support

🀝 Contribution Flow

Fork β†’ Clone β†’ Branch β†’ Commit β†’ Push β†’ Pull Request β†’ Review β†’ Merge

Read CONTRIBUTING.md for SWoC 2026 guidelines.


πŸ‘₯ Team

Name Role
Om Roy Project Lead Β· Web Β· ML
Shubhangi Roy ML Β· Backend

🀝 Contributing & Support

We love contributions! Please read our CONTRIBUTING.md to get started with SWoC 2026 tasks. Whether it's fixing bugs, adding features, or improving documentation, your help is always welcome!


✨ Contributors

Thanks to all the wonderful people contributing to this project! πŸ’–

Contributors

View full contribution graph


For production use, run the backend with a WSGI server like gunicorn:

pip install gunicorn
gunicorn app:app

πŸ”‘ API Keys Guide

  • Gemini API Key: Google AI Studio se generate karein.
  • Firebase Keys: Firebase Console se apne project ke liye keys lein.
  • API keys ko .env file me store karein (kabhi bhi repo me commit na karein).

🐞 Reporting Issues

Found a bug or want a new feature? Open an issue.


πŸ“„ License

This project is licensed under the MIT License.


πŸ› οΈ Common Issues & Fixes

  • ❌ ModuleNotFoundError πŸ‘‰ Run pip install -r requirements.txt

  • ❌ Firebase config error πŸ‘‰ Ensure .env values match Firebase Console

  • ❌ CORS issue πŸ‘‰ Make sure backend runs before frontend

  • ❌ Port already in use πŸ‘‰ Change port in app.py or stop previous process

❓ FAQ

Q: The project is not running. What should I do? A: Make sure all Python dependencies are installed, the .env file is properly configured, and the correct API keys are being used.

Q: How do I get a Gemini/Firebase API key? A: Refer to the β€œAPI Keys Guide” section above for step-by-step instructions.

Q: I am seeing the warning β€œThis is a development server…” on the Flask server. What does it mean? A: This server is intended only for development. For production, use a WSGI server such as Gunicorn.

Q: I accidentally pushed my .env file. What should I do? A: Immediately rotate/regenerate your API keys, remove the .env file from Git tracking, add it to .gitignore, and clean the repository history if required.

Q: The /health endpoint is not responding. What could be wrong? A: Ensure the backend server is running correctly and that the /health route is properly implemented.


Made with ❀️ by the AgriTech Community β€” SWoC 2026

About

AgriTech is an AI-powered web platform that offers crop recommendations, yield prediction, disease detection, and collaborative tools to empower farmers and promote smart, sustainable agriculture.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 139