The Bangla Agricultural Advisor Chatbot is a Django-based web application designed to assist farmers and agricultural enthusiasts in Bangladesh by providing advice and solutions in the Bengali language. The chatbot supports three interaction modes:
- Text Query: Users can type their questions in Bengali and receive relevant advice.
- Voice Query: Users can speak their queries in Bengali, and the chatbot will transcribe and respond with advice.
- Image Upload: Users can upload images of crops to detect diseases and receive actionable suggestions.
The project leverages machine learning models for natural language processing (NLP) and image classification to provide accurate responses.
- Users can input their questions in Bengali.
- The system uses a TF-IDF vectorizer and cosine similarity to match user queries with pre-defined answers from a dataset.
- Users can speak their queries in Bengali using a microphone.
- The system uses Google Web Speech API to transcribe the audio into text and processes it similarly to text queries.
- Users can upload images of crops to detect diseases.
- A TensorFlow-based deep learning model classifies the uploaded image and matches it with relevant disease control advice from the dataset.
- The frontend dynamically updates based on user interactions (text, voice, or image).
- Separate sections are displayed for disease detection results and advice.
bangla_agriculture_chatbot/
├── chatbot/
│ ├── static/
│ │ ├── models/
│ │ │ ├── disease_detection_model.h5
│ │ │ ├── tfidf_vectorizer.joblib
│ │ │ ├── tfidf_matrix.joblib
│ │ │ └── class_labels.json
│ │ └── samples/
│ ├── templates/
│ │ └── chatbot/
│ │ └── index.html
│ ├── views.py
│ └── urls.py
├── data/
│ └── agriculture_data.csv
├── manage.py
├── requirements.txt
└── README.md
-
Clone the Repository
git clone https://github.com/your-repo/bangla-agricultural-advisor-chatbot.git cd bangla-agricultural-advisor-chatbot -
Create
venv(virtual machine)python3 -m venv venv
-
Activate
venvsource venv/bin/activate -
Install Dependencies
pip install -r requirements.txt
-
Download Pre-trained Models
- Place the pre-trained models (
disease_detection_model.h5,tfidf_vectorizer.joblib,tfidf_matrix.joblib, andclass_labels.json) in thechatbot/static/models/directory.
- Place the pre-trained models (
-
Prepare Dataset
- Place the dataset file (
agriculture_data.csv) in thedata/directory.
- Place the dataset file (
-
Run Migrations
python manage.py migrate
-
Start the Development Server
python manage.py runserver
-
Access the Application Open your browser and navigate to
http://127.0.0.1:8000.
- Enter your question in the text input field and click "পরামর্শ নিন".
- The chatbot will display the most relevant advice based on your query.
- Click the microphone button ("🎤 কথা বলুন").
- Speak your query in Bengali.
- The chatbot will transcribe your speech and provide advice.
- Click "ফসলের ছবি আপলোড করুন" to upload an image of a crop.
- The chatbot will analyze the image, detect any diseases, and provide actionable suggestions.
- The system uses a TF-IDF vectorizer to transform user queries and pre-defined questions into numerical vectors.
- Cosine similarity is used to find the best match between the user query and the dataset.
- The uploaded image is preprocessed and fed into a TensorFlow-based deep learning model.
- The model predicts the disease class, which is then matched with relevant advice from the dataset.
- Audio input is captured using the microphone and transcribed into text using Google Web Speech API.
- The transcribed text is processed similarly to text queries.
The dataset (agriculture_data.csv) contains three columns:
- Category (Bangla): Questions category.
- Question (Bangla): Common agricultural questions in Bengali.
- Answer (Bangla): Corresponding advice or solutions in Bengali.
Ensure that the dataset is updated regularly to improve the chatbot's accuracy.
- Multilingual Support: Add support for other regional languages.
- Improved Disease Detection: Fine-tune the deep learning model for better accuracy.
- Mobile App: Develop a mobile-friendly version of the chatbot.
- User Authentication: Allow users to save their queries and track previous interactions.
For any questions or feedback, please contact:
- Email: mst.tahminajerinarju@example.com
- GitHub: @arju10
- LinkedIn: @arju10
- Facebook: @arju10.arju



