AgriVision is an AI-powered, fully client-side smart agriculture platform that helps farmers diagnose plant diseases and predict crop health risks — no backend required.
| Feature | Description |
|---|---|
| 🔬 Disease Diagnosis | Upload a leaf image → instant AI-powered disease detection with organic & chemical cure recommendations |
| 📊 Risk Prediction | Input weather data (temp, humidity, rainfall) → predict disease risk before infection occurs |
| 📍 Auto Weather | Use your device's GPS + OpenWeatherMap to auto-fill weather conditions |
| 📋 Prediction History | All predictions saved locally — review and clear anytime |
| ⚡ 100% Client-Side | Runs TFLite AI model directly in your browser via TensorFlow.js & WASM — no server needed |
| 📱 Fully Responsive | Mobile-first design with hamburger sidebar for all screen sizes |
👉 https://ai-smart-agriculture.vercel.app/
git clone https://github.com/codeXsidd/AI-Smart-Agriculture.git
cd AI-Smart-Agriculture/frontend
# Serve over HTTP (required for model fetch to work)
npx serve .
# or
python -m http.server 8080Then open http://localhost:8080 in your browser.
⚠️ Important: Openingindex.htmldirectly viafile://won't work because of browser fetch restrictions. Always serve via HTTP.
cd backend
pip install -r requirements.txt
uvicorn main:app --reloadThe FastAPI server will start at http://127.0.0.1:8000. You can test endpoints at http://127.0.0.1:8000/docs.
User uploads leaf image
↓
TensorFlow.js loads TFLite model (~11 MB, runs in-browser via WASM)
↓
Image preprocessed: resized to 224×224, normalized [0,1]
↓
TFLite model runs inference → 65-class probability distribution
↓
Top class selected → Disease name + cure recommendation displayed
For Risk Prediction, a scikit-learn RandomForest model was pre-computed into a JavaScript lookup table (risk_model.js), enabling instant serverless predictions.
AI-Smart-Agriculture/
├── frontend/
│ ├── index.html # Disease Diagnosis page
│ ├── before.html # Risk Prediction page
│ ├── history.html # Prediction History page
│ ├── style.css # Premium glassmorphism UI
│ ├── script.js # Client-side AI inference engine
│ ├── disease_data.js # 65-class disease labels + cure database
│ ├── risk_model.js # Exported sklearn RandomForest as JS
│ └── model/
│ └── smart_agri_model_quant.tflite # Quantized TFLite model
└── backend/
├── main.py # FastAPI server (optional)
├── cure_dict.py # Disease cure dictionary
├── requirements.txt # Python dependencies
├── model1/ # TFLite disease classification model
└── model2/ # sklearn risk prediction model + encoders
| Layer | Technology |
|---|---|
| Frontend | HTML5, Vanilla CSS (Glassmorphism), JavaScript ES2022 |
| AI Runtime | TensorFlow.js 4.x + TFLite WASM Runtime |
| Disease Model | MobileNetV2-based TFLite (~11MB, 65-class PlantVillage) |
| Risk Model | RandomForest (scikit-learn, exported as JS) |
| Weather API | OpenWeatherMap API |
| Backend (Optional) | Python, FastAPI, Uvicorn |
| Deployment | Vercel (frontend), Render (backend API optional) |
Apple • Blueberry • Cherry • Corn/Maize • Grape • Orange • Peach • Pepper • Potato • Raspberry • Soybean • Squash • Strawberry • Tomato
Potato • Rice • Wheat
Contributions are welcome! Please feel free to:
- Submit bug reports or feature requests via Issues
- Fork the repo and submit a Pull Request
- Star ⭐ the repo if you find it useful!
MIT License — free to use, modify, and distribute.