AgriSense - AI Powered Smart Farming 🌱
AgriSense is a comprehensive, AI-driven agricultural platform designed to empower farmers with real-time insights, intelligent recommendations, and community support. It bridges the gap between traditional farming and modern technology, ensuring better yields, sustainable practices, and improved profitability.
The repository is currently entering a staged rebuild to support backend-focused production architecture:
- Main API service: Node.js + Express (
backend-node/) - Frontend application: React (
frontend/, migration in progress) - ML inference service: Python (
ml-service/) - Planning and contracts:
coreplan.mdandshared-docs/
Legacy implementation remains available in existing backend/ and frontend/ assets during migration.
AgriSense offers a wide array of tools tailored for the modern farmer:
- Targeted Crop Recommendation: Uses Random Forest algorithms to suggest the most suitable crops based on NPK levels, pH, rainfall, temperature, and location.
- Smart NPK Auto-Fill: Automatically fetches average soil nutrient profiles for districts in North Karnataka, simplifying data entry.
- Pest & Disease Detection: Upload photos of affected crops to instantly identify diseases or pests and receive organic/chemical treatment advice.
- AI Farming Assistant: A 24/7 Chatbot powered by LLMs (OpenRouter) capable of answering complex farming queries in real-time.
- Voice-First Interface: integrated with Deepgram for high-accuracy voice-to-text, allowing farmers to interact with the app using voice commands in their native language.
- Profit & Loss Calculator: A dedicated financial tool to track farming expenses (seeds, fertilizers, labor) vs. revenue, helping farmers analyze their profit margins.
- Soil Testing Kit: Integrated service to request affordable soil testing kits directly to the farm.
- Crop Calendar: Customized schedules for sowing, irrigation, and harvesting based on the selected crop and season.
- Fertilizer Guide: Detailed instructions on fertilizer application rates and methods.
- Real-time Market Prices: Live updates on crop prices in various markets (APMC) to ensure fair trade.
- Government Schemes: A curated list of agricultural subsidies and government welfare schemes with application details.
- Helpline Directory: Direct access to Kisan Call Centers and State Agriculture Departments.
- Learning Hub: A repository of farming tutorials, guides, and best practices.
- Community Forum: A platform for farmers to connect, share success stories, upload photos, and ask for peer advice.
- Multilingual Support: Fully localized in English, Hindi (हिंदी), and Kannada (ಕನ್ನಡ).
- Offline Capability: Designed to work partially offline in low-connectivity rural areas.
- Responsive UI: Built with Tailwind CSS for a seamless experience on mobile devices and desktops.
- Frontend: HTML5, Tailwind CSS, Vanilla JavaScript (Modular ES6 architecture)
- Backend: Python, Flask (REST API)
- Machine Learning: Scikit-Learn (Random Forest), Pandas, NumPy
- AI Services:
- OpenRouter (LLM for Chatbot)
- Deepgram (Voice Transcription)
- Deployment: Ready for Render/Heroku (Gunicorn WSGI)
agrisense/
├── backend/
│ ├── app.py # Main Application Server (Flask)
│ ├── model/ # Serialized ML Models (.pkl)
│ ├── data/ # Datasets (Soil averages, Crop content)
│ └── requirements.txt # Python Dependencies
├── frontend/
│ ├── index.html # Landing Home Page
│ ├── crop-recommendation.html # Prediction Tool
│ ├── pest-detection.html # Image Analysis Tool
│ ├── profit-loss.html # Calculator Tool
│ ├── community.html # Social Forum
│ ├── js/
│ │ ├── config.js # API Configuration
│ │ ├── common.js # Shared Navigation & Validations
│ │ └── chatbot.js # AI Chat Logic
│ └── ... (other pages)
└── README.md # Documentation
- Python 3.8+
- Git
-
Clone the Repository
git clone https://github.com/Basavaraj8143/agrisense.git cd agrisense -
Set up Virtual Environment
python -m venv venv # Windows .\venv\Scripts\activate # Mac/Linux source venv/bin/activate
-
Install Dependencies
pip install -r backend/requirements.txt
-
Configure Environment Create a
.envfile in the root directory:DEEPGRAM_API_KEY=your_deepgram_key_here OPENROUTER_API_KEY=your_openrouter_key_here FLASK_DEBUG=True
-
Run the Application
python backend/app.py
Access the app at
http://localhost:5000
The project is configured for easy deployment on Render.
- Push code to GitHub.
- Create a new Web Service on Render linked to your repo.
- Build Command:
pip install -r backend/requirements.txt - Start Command:
gunicorn --chdir backend app:app - Add your API keys in the environment variables settings.
We welcome contributions!
- Fork the Project
- 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
Distributed under the MIT License. See LICENSE for more information.
Empowering Farmers, One Click at a Time. 🌾