# 🌿 Ethiopian Crop Recommendation Chatbot
### AI-Powered System for Endemic Plants in Ethiopia
---
## 📋 Project Overview
This is a complete AI-powered chatbot that recommends the best **endemic Ethiopian crops**
based on soil conditions, climate, altitude, and region — using a **Random Forest ML model**
trained on real Ethiopian agro-ecological data (1,500 rows).
### Supported Crops
| Crop | Amharic | Type |
|------|---------|------|
| Teff | ጤፍ | Highland grain |
| Enset | እንሰት | Highland staple |
| Coffee Arabica | ቡና | Export crop |
| Noug | ኑግ | Oilseed |
| Barley | ገብስ | Highland grain |
| Sorghum | ማሾ | Lowland grain |
| Finger Millet | ዳጉሣ | Nutritious grain |
| Chickpea | ሽምብራ | Legume |
| Linseed | ተልባ | Oilseed |
| Maize | በቆሎ | Staple grain |
---
## 🗂️ Project Structure
```
ethiopian_crop_chatbot/
├── backend/
│ ├── app.py ← Flask server + chatbot engine
│ ├── requirements.txt ← Python dependencies
│ ├── ml/
│ │ └── train_model.py ← ML training script (run once)
│ ├── models/ ← Saved ML models (auto-generated)
│ │ ├── crop_model.pkl
│ │ ├── soil_encoder.pkl
│ │ ├── region_encoder.pkl
│ │ ├── crop_encoder.pkl
│ │ └── meta.json
│ └── dataset/
│ └── ethiopian_crop_recommendation_dataset.xlsx
├── frontend/
│ └── index.html ← Full chatbot UI (pure HTML/JS)
└── database/
└── schema.sql ← SQL Server schema + seed data
```
---
## ⚙️ Installation & Setup
### Prerequisites
- Python 3.9 or higher
- pip (Python package manager)
### Step 1 — Install Python dependencies
```bash
cd backend
pip install -r requirements.txt
```
### Step 2 — Train the ML model (run once)
```bash
python ml/train_model.py
```
This reads the Excel dataset, trains a Random Forest classifier, and saves:
- `models/crop_model.pkl`
- `models/soil_encoder.pkl`
- `models/region_encoder.pkl`
- `models/crop_encoder.pkl`
- `models/meta.json`
Expected output:
```
✅ Accuracy: ~68% …