An AI-powered agricultural assistance platform combining plant disease detection and intelligent knowledge retrieval for farmers and agricultural professionals.
- 🔬 Plant Disease Detection: AI-powered disease identification using Vision Transformer models
- 🧠 Agricultural Knowledge Assistant: RAG-powered Q&A system for farming guidance
- 🌐 Web Interface: Modern React frontend with image upload and voice input
- 🔗 Integrated Analysis: Combined image + query processing for comprehensive insights
- 🌾 Crop-Specific Insights: Specialized knowledge for Corn, Potato, Rice, and Wheat
- 📊 Market Intelligence: Real-time market data and price information
- 🗺️ Regional Expertise: Focused on West Bengal agriculture and practices
The easiest way to run AgriMind with all dependencies:
# Clone the repository
git clone <repository-url>
cd AgriMind
# Start everything with one command (includes databases!)
./start-agrimind.sh # macOS/Linux
# OR
start-agrimind.bat # Windows
# Or manually with docker-compose
docker-compose up --buildThis will start:
- PostgreSQL database with pgvector extension
- Redis for caching
- AgriMind API server
- All services accessible at localhost
# Clone the repository
git clone <repository-url>
cd AgriMind
# One-command setup (creates venv, installs dependencies, starts Docker)
pnpm setup # macOS/Linux
# OR
pnpm setup:windows # Windows
# Start the application
pnpm devOpen http://localhost:3000 in your browser and start analyzing your crops!
Important: You need a Gemini API key for the AI assistant to work properly.
-
Get your Gemini API key:
- Go to Google AI Studio
- Create a new API key (free tier available)
-
Set your API key:
# Edit the environment file nano apps/rag-script/.env # Replace this line: GEMINI_API_KEY=your_gemini_api_key_here # With your actual key: GEMINI_API_KEY=your_actual_api_key_here
-
Optional configurations:
apps/api/.env- API server settings (defaults work fine)apps/rag-script/.env- RAG system settings (defaults work fine)
Detect diseases in plant images with high accuracy:
# Detect disease in an image (human-readable output)
npm run detect-disease path/to/image.jpg
# Get JSON output for API integration
npm run detect-disease path/to/image.jpg -- --json
# Quiet mode (suppress loading messages)
npm run detect-disease path/to/image.jpg -- --quiet --jsonSupported diseases: 13+ conditions across Corn, Potato, Rice, and Wheat including rusts, blights, spots, and healthy conditions.
Get intelligent answers to farming questions:
# Interactive mode - ask questions interactively
npm run ask-agrimind
# Single query with human-readable output
npm run ask-agrimind -- --query "What are the best crops for West Bengal during Kharif season?"
# Get JSON output for API integration
npm run ask-agrimind -- --query "Rice prices in Kolkata" --format json
# Market-specific queries
npm run ask-agrimind -- --query "Current vegetable prices" --type market
# Regional queries with filters
npm run ask-agrimind -- --query "Farming practices in Murshidabad" --region "Murshidabad"Knowledge base includes: ICAR reports, market data, farming advisories, weather patterns, and crop recommendations.
- Python 3.8+
- Node.js 18+ and pnpm
- Docker
That's it! The setup script handles everything else.
If you prefer manual setup or encounter issues:
-
Create Python virtual environment:
python3 -m venv .venv source .venv/bin/activate # On Windows: .venv\Scripts\activate
-
Install all dependencies:
pnpm install pip install -r apps/api/requirements.txt pip install -r apps/rag-script/requirements.txt pip install -r apps/ml-inference/requirements.txt pip install -r packages/kb/requirements.txt
-
Start Docker services:
Option A: Complete Stack (Recommended)
# Start everything including databases docker-compose up --buildOption B: Infrastructure Only
docker compose -f infra/compose.yml up -d
-
Initialize RAG system (if using Option B):
cd apps/rag-script && python setup_db.py && python load_knowledge_base.py && cd ../..
AgriMind/
├── apps/
│ ├── api/ # Backend API server
│ ├── frontend/ # Next.js web interface
│ ├── ml-inference/ # Disease detection service
│ └── rag-script/ # Knowledge retrieval service
├── packages/
│ ├── ui/ # Shared UI components
│ ├── kb/ # Knowledge base processing
│ └── typescript-config/ # Shared TypeScript configs
└── infra/
└── compose.yml # Docker services
# Check if environment variables are set correctly
pnpm check-env
# Test disease detection
npm run detect-disease apps/ml-inference/test_leaf.jpg
# Test RAG system (requires Gemini API key)
npm run ask-agrimind -- --query "What crops are good for West Bengal?"
# Check system health
npm run ask-agrimind -- --health-checkAgriMind includes a complete Docker setup with databases for easy deployment:
# Start the complete stack (recommended)
./start-agrimind.sh # macOS/Linux
start-agrimind.bat # Windows
# Or manually
docker-compose up --build- PostgreSQL: Database with pgvector extension for embeddings
- Redis: Caching and session management
- AgriMind API: Complete backend with all services
- API Server: http://localhost:8000
- API Documentation: http://localhost:8000/docs
- Health Check: http://localhost:8000/health
- Database: localhost:5432 (user: agrimind, password: agrimind)
- Redis: localhost:6379
# Start services
docker-compose up --build
# View logs
docker-compose logs -f api
# Stop services
docker-compose down
# Rebuild specific service
docker-compose build api && docker-compose up -d apiFor detailed Docker setup information, see DOCKER_SETUP.md.
# Start all services in development mode
pnpm dev
# Run linting across all packages
pnpm lint
# Build all packages
pnpm build- Plant Disease Detection - Detailed ML inference documentation
- RAG System - Knowledge retrieval system guide
- Knowledge Base Processing - Data processing pipeline
- Frontend - Web interface documentation