Spaces:
Sleeping
Sleeping
A newer version of the Streamlit SDK is available: 1.57.0
πΎ Rice Disease Detection & Chatbot Assistant
An advanced AI-powered web application for detecting rice leaf diseases from images, generating multilingual expert diagnosis, and answering agricultural queries via chatbotβall deployed with Gradio on Hugging Face Spaces.
π Overview
This app intelligently detects rice leaf diseases using a deep learning model and provides a comprehensive diagnosis report using CrewAI agents. It supports English, Urdu, and Hindi outputs and generates voice notes for farmer-friendly interaction.
π― Key Features
- β Detect 10 types of rice leaf diseases using a trained CNN model.
- π§ Multi-agent diagnosis pipeline using CrewAI + OpenAI API.
- π Multilingual translation (English, Urdu, Hindi) via Groq API.
- π Voice note generation using gTTS for easy understanding.
- π€ Built-in agriculture-themed chatbot for rice-related queries.
π§ͺ Tech Stack
π¨ Frontend
- Gradio: UI for file upload, language selection, and chatbot.
- Hugging Face Spaces: Deployment platform.
π§ Backend
- TensorFlow/Keras: Rice disease image classification model.
- CrewAI: Multi-agent system for diagnosis logic.
- OpenAI API: LLM-powered agents (Pathologist, Agronomist, Risk Advisor).
- Groq API: Fast LLM inference and translation.
- LangChain: Tool chaining and agent orchestration.
- gTTS: Text-to-speech audio generation.
- FAISS + SentenceTransformer: Chatbot RAG response system.
𧬠Architecture
graph TD
A[User Uploads Rice Leaf Image] --> B[TensorFlow Disease Prediction]
B --> C[CrewAI Agent Pipeline]
C --> D[Diagnosis: Pathologist, Agronomist, Risk Advisor]
D --> E[Groq Translation to Selected Language]
E --> F[Text + Voice Output using gTTS]
A2[User Asks a Rice Question] --> G[Chatbot RAG Engine]
G --> E
π€ CrewAI Agents
- Pathologist Agent: Explains disease cause and symptoms.
- Agronomist Agent: Suggests treatment and crop care.
- Risk Advisor Agent: Evaluates disease severity and urgency.
π Language Support
| Language | Text Output | Voice Note |
|---|---|---|
| English | β | β |
| Urdu | β | β |
| Hindi | β | β |
π How to Run Locally
- Clone this repository or download files.
- Add your API keys in environment variables:
GROQ_API_KEYOPENAI_API_KEY
- Install dependencies:
pip install -r requirements.txt - Run the app:
python app.py
ποΈ Deployment (Hugging Face Spaces)
- Create a new Space β Gradio + Python.
- Upload:
app.pymodel.h5rice_chatbot.pycrew_agents.pyrequirements.txt
- Add API keys in "Secrets":
GROQ_API_KEYOPENAI_API_KEY
- Click Deploy.
π¦ File Structure
π cropdoctor/
βββ app.py # Main Gradio app
βββ model.h5 # Trained rice disease model
βββ rice_chatbot.py # Chatbot component
βββ crew_agents.py # CrewAI agent setup
βββ requirements.txt # Python dependencies
π Credits
- π§βπ» Developed by
- π€ Powered by Groq API, OpenAI, and CrewAI
π License
This project is open-source and available under the MIT License.