FarmiPal — An AI-powered agricultural assistant for smallholder farmers in East Africa. Features agentic crop disease diagnosis, RAG-powered farming chat, real-time market intelligence, and surplus risk detection to prevent post-harvest losses. Built with Next.js, Django, and AMD ROCm.
# FarmiPal
> An AI-powered agricultural assistant designed to help farmers diagnose crop diseases, access market insights, detect surplus risks, and get real-time guidance — built with a modern, scalable full-stack architecture.
---
## 📋 Table of Contents
- Overview
- Core Features
- 📸 Image Diagnosis
- 💬 Smart Chat
- 📊 Market Trends
- 🌍 Surplus Insights
- Architecture
- Tech Stack
- Project Structure
- Getting Started
- API Reference
- Development Workflow
- GPU Integration (Upcoming)
- Pre-GPU Checklist
- Roadmap
- Contributing
---
## Overview
FarmiPal is a farmer-first AI platform built to close the information gap between smallholder farmers and the tools they need to make better decisions. It does this through four tightly integrated features:
| Feature | What It Does | AI Method |
|---|---|---|
| 📸 **Image Diagnosis** | Identifies crop diseases from photos | Pretrained vision model + LLM explanation |
| 💬 **Smart Chat** | Answers farming questions conversationally | RAG pipeline + localization |
| 📊 **Market Trends** | Shows price trends and interprets them | Simple analytics + LLM narrative |
| 🌍 **Surplus Insights** | Predicts regional oversupply risk | Heuristics + weather data + LLM explanation |
The system uses **Next.js** as a fast, mobile-first UI layer and **Django** as the core backend for AI orchestration, data persistence, and async job handling. All AI logic is decoupled and GPU-ready.
---
## Core Features
---
## 📸 Feature 1: Image Diagnosis
> **"Take a photo. Know what's wrong. Know what to do."**
### What It Does
A farmer photographs a crop showing signs of disease or stress. FarmiPal runs the image through a pretrained vision model to classify the condition, then passes the classification result to an LLM to generate a practical, localized explanation with specific action steps.
### Why Two Models?
The vision model is fast and accurate at classification but produces only a label (e.g., `"maize_leaf_blight"`). That label alone i …