AI system to identify crop type, diagnose plant diseases from images, and deliver multilingual text/voice advice with offline-first deployment.
- Crop and disease identification via separate CNNs for precision and speed.
- Actionable advice from a local, fine-tuned LLM with safety filters.
- Multilingual chatbot with STT/TTS for low-connectivity, accent-robust use.
- Sustainability focus: targeted treatments to reduce pesticide overuse.
- DL: PyTorch/TensorFlow, OpenCV, PIL, NumPy, Pandas
- LLM/Runtime: Transformers, Optimum, ONNX Runtime, TensorRT
- Backend: FastAPI or Node.js, PostgreSQL
- Voice: Whisper (STT), VITS (TTS)
- PlantVillage (~54k images)
- PlantDoc (~2.6k images)
- Custom regional crop/disease images
- Common Voice (selected languages)
- Crop ID: MobileNetV2 (transfer learning)
- Disease: ResNet50/EfficientNet (class-balanced)
- Advice: Gemma 3 (via Ollama)
- Chatbot: Whisper + VITS
- Crop ID: ≥90% accuracy, ≤1s inference
- Disease: ≥85% F1, high early-stage recall
- Advice: ≤2s response, safe/relevant outputs
- Chatbot: ≥85% intent accuracy, tracked WER
- Python 3.10+
- CUDA (recommended for faster inference)
- ffmpeg (for voice features)
- PostgreSQL (for data storage)
- Ollama (for running LLM locally)
-
Clone the repository and install requirements:
git clone <repository-url> cd Crop-Diseases-ChatBot-Advice python -m venv venv source venv/Scripts/activate pip install -r requirements.txt
-
Install Ollama:
- Download and install from Ollama's official website
- Or use the following command:
curl -fsSL https://ollama.com/install.sh | sh
-
Pull the required LLM model:
ollama pull gemma3
-
Start the Ollama server (if not running automatically):
ollama serve
-
Start the application:
python app.py
The application will be available at
http://127.0.0.1:7860
- Upload a crop image for analysis
- View the diagnosis and care advice
- Ask follow-up questions in the chat interface
For development with the API:
- POST image to
/predict/cropfor crop identification - POST to
/predict/diseasefor disease diagnosis - Request advice via
/advice - Chat via
/chat(supports text/audio)
- POST /predict/crop → {crop, top_k, confidence}
- POST /predict/disease → {disease, severity, notes}
- POST /advice → {treatment, prevention, followup}
- POST /chat → {text_out, audio_out?}
- models/ (cnn/, llm/, stt_tts/)
- api/ (routes/, schemas/)
- data/ (raw/, processed/)
- scripts/ (train_, export_, serve_*)
- configs/ (.env, model/config.yaml)
- Expand regional datasets and balance rare diseases
- Improve early-stage recall and edge latency
- Broaden language/accent coverage
- Add offline bundles and edge profiles
Choose a permissive OSS license; respect dataset licenses.