- Disease Detection : Upload a leaf image to identify crop diseases using YOLO.
- AI Chatbot : Ask questions about the detected diseases, powered by LangChain and ChatGroq.
- Interactive UI : User-friendly interface built with React.
.
├── backend/ # Backend server and AI processing logic
│ ├── app.py # Flask API for handling image uploads and chatbot queries
│ ├── chat.py # Chatbot logic using LangChain and plant disease information
│ ├── inference.py # YOLO inference for disease detection
│ ├── best.pt # YOLO model weights
│ ├── yolotrain.ipynb # Notebook for YOLO model training
├── frontend/ # Frontend React application
│ ├── public/ # Static files
│ │ ├── index.html # Main HTML file
│ ├── src/ # React components and logic
│ │ ├── App.js # Main React component
│ │ ├── App.css # Styles for the application
├── README.md # Documentation (this file)
- Implements a chatbot to guide users about crop diseases.
- Uses LangChain with the ChatGroq model for natural language understanding.
- Contains a dictionary (
class_info_dict) with detailed information about healthy and diseased leaves.
Key Functionality:
def chatbot(info, history, message):
# Generates chatbot responses using the LangChain library- Handles disease detection using a YOLO model (
best.pt). - Outputs detected classes and visualizes bounding boxes on the image.
Key Functionality:
def inference(image):
# Performs YOLO inference and returns processed image and detected classes- Flask server to connect the backend with the frontend.
- Two main endpoints:
/upload: Accepts leaf images, detects diseases, and returns results./chat: Processes user queries based on detected diseases.
- The main React component for the frontend.
- Provides the following features:
- Image upload and preview.
- Disease detection using the
/uploadbackend endpoint. - Chat functionality using the
/chatbackend endpoint. - Displays processed image and detected labels.
- Python 3.8+
- Node.js and npm
- Navigate to the
backend/directory. - Create a
.envfile with the following content:GROQ_API_KEY=<your-groq-api-key> - Install dependencies:
pip install flask flask-cors opencv-python numpy langchain-groq ultralytics python-dotenv
- Run the server:
python app.py
- Navigate to the
frontend/directory. - Install dependencies:
npm install
- Start the development server:
npm start
- Start the backend and frontend servers.
- Open the React app in your browser (typically at
http://localhost:5000). - Upload a leaf image and process it to detect diseases.
- Use the chatbot to ask questions about the detected diseases.
- Backend :
- Flask
- YOLO (Ultralytics)
- LangChain + ChatGroq
- Frontend :
- React.js
- Bootstrap (for styling)
- Add more robust error handling.
- Improve chatbot's conversational capabilities.
- Expand the dataset for YOLO training to include more crop diseases.
14f224b9f5010fd509a269137699818c98b04bef