# π± Shamba-Smart β Voice Assistant for Kenyan Farmers
A WhatsApp-linked voice bot that detects Swahili or Kikuyu automatically, retrieves agricultural advice from a RAG knowledge base, and replies with expert voice responses.
---
## π Project Structure
```
MSHAURI-WA-WAKULIMA-BOT/
βββ BACKEND/
β βββ app.py β Flask webhook server
β βββ requirements.txt β Python dependencies
β βββ .env.example β Config template
β βββ asr/
β β βββ kikuyu_asr.py β Kikuyu ASR (HuggingFace)
β β βββ swahili_asr.py β Swahili ASR (HuggingFace)
β β βββ language_detector.pyβ Cascading ASR β picks best model
β βββ services/
β β βββ intent_router.py β Groq LLM: classify query intent
β β βββ crop_advisor.py β RAG-powered crop diagnosis
β β βββ rag_indexer.py β One-time indexer for knowledge base
β β βββ market_prices.py β Marigiti & Wakulima prices
β β βββ weather.py β Open-Meteo 3-day forecast
β β βββ tts.py β gTTS text-to-speech
β β βββ audio_utils.py β OGGβWAV conversion
β βββ database/
β β βββ db.py β SQLAlchemy ORM + helpers
β βββ tests/
β βββ test_shamba_smart.pyβ Unit tests
β
βββ DATABASE/
β βββ init_db.py β Create SQLite schema
β βββ knowledge_base/
β β βββ kalro_crop_diseases.txt β Crop disease guide
β β βββ soil_management.txt β Fertilizers & soil
β β βββ pest_control.txt β IPM pest guide
β β βββ seasonal_calendar.txt β Planting calendar by region
β β βββ market_prices.json β Commodity price data
β βββ chroma_store/ β Created by rag_indexer.py
β
βββ FRONTEND/ β Future admin dashboard
```
---
## β‘ Quick Start
### 1. Install Dependencies
```powershell
cd MSHAURI-WA-WAKULIMA-BOT\BACKEND
..\ukulima-env\Scripts\Activate.ps1
pip install -r requirements.txt
```
### 2. Configure Environment
```powershell
Copy-Item .env.example .env
# β¦