Logo Lanfrica

Morasho/shamba-ai

Domain:

agriculture

Record type:

software
Creator:
Mor
Host:
# Shamba AI 🌿 Crop disease detection for Kenyan smallholder farmers. Upload or photograph a diseased leaf β†’ get a diagnosis, treatment steps, yield impact estimate, and nearest agro-vet β€” in English or Swahili. --- ## Quick start (local dev) ```bash cp .env.example .env # fill in your keys docker compose up # API + worker + Redis + Postgres + frontend ``` Frontend: localhost API docs: localhost --- ## Project structure ``` shamba-ai/ β”œβ”€β”€ backend/ β”‚ β”œβ”€β”€ app/ β”‚ β”‚ β”œβ”€β”€ api/routes/ # FastAPI routers β”‚ β”‚ β”‚ β”œβ”€β”€ diagnosis.py # submit, poll result, feedback β”‚ β”‚ β”‚ └── knowledge.py # disease knowledge base β”‚ β”‚ β”œβ”€β”€ core/ # config, database β”‚ β”‚ β”œβ”€β”€ models/ # SQLAlchemy models β”‚ β”‚ β”œβ”€β”€ schemas/ # Pydantic schemas β”‚ β”‚ β”œβ”€β”€ services/ β”‚ β”‚ β”‚ β”œβ”€β”€ preprocessing.py # CLAHE, unsharp mask, white balance β”‚ β”‚ β”‚ β”œβ”€β”€ inference.py # ONNX Runtime + TTA + temperature scaling β”‚ β”‚ β”‚ β”œβ”€β”€ gradcam.py # Grad-CAM heatmap generation β”‚ β”‚ β”‚ β”œβ”€β”€ knowledge.py # disease KB with Kenyan treatments β”‚ β”‚ β”‚ β”œβ”€β”€ storage.py # Cloudflare R2 β”‚ β”‚ β”‚ └── sms.py # Africa is Talking SMS β”‚ β”‚ └── tasks/ β”‚ β”‚ └── celery_app.py # async inference worker β”‚ └── ml/ β”‚ β”œβ”€β”€ train.py # EfficientNet-B0 + Albumentations β”‚ β”œβ”€β”€ export_onnx.py # PyTorch β†’ ONNX β”‚ └── calibrate.py # temperature scaling └── frontend/ └── src/ β”œβ”€β”€ components/ β”‚ β”œβ”€β”€ capture/ # CaptureScreen with tips + quality check β”‚ β”œβ”€β”€ diagnosis/ # Result screen + diagnosing screen β”‚ β”œβ”€β”€ layout/ # AppLayout + header β”‚ └── ui/ # LanguageToggle β”œβ”€β”€ hooks/ β”‚ └── useDiagnosis.ts # full flow: compress β†’ quality check β†’ upload β†’ poll β”œβ”€β”€ lib/ β”‚ β”œβ”€β”€ api.ts # API client β”‚ β”œβ”€β”€ imageUtils.ts # compression + blur detection β”‚ └── uploadQueue.ts # IndexedDB offline queue └── i18 …