AgroScout — Gemma 4 crop-disease diagnosis for smallholder farmers in Ogbomoso, Nigeria. Build With Gemma hackathon (GDGOC LAUTECH).
# 🌿 AgroScout — a crop doctor in your pocket
**Built for the Build With Gemma — GDGOC LAUTECH hackathon · Track: Health, Finance & Agric Infra**
Ogbomoso is one of the largest agrarian hubs in Oyo State, Nigeria — but there is
roughly one agricultural extension officer for thousands of farmers. When cassava
mosaic, tomato blight or fall armyworm strikes, most smallholders guess, spray the
wrong thing, or lose the harvest.
AgroScout turns any phone into an extension officer. A farmer photographs a sick
plant and **Gemma 4** identifies the crop and the problem, grades the severity,
and writes a budget-conscious treatment plan — organic options first, chemical
active ingredients (not brands) with safety notes, and prevention for next season.
Every diagnosis ships with a **Yorùbá summary and action steps**, and a follow-up
chat can check the live Ogbomoso weather forecast before recommending a spray day.
## How Gemma 4 is used
| Capability | Where |
|---|---|
| **Multimodal vision** | The crop photo goes straight to `google/gemma-4-31b-it` — no separate CV model |
| **Structured output** | The diagnosis is streamed as a typed JSON object (`streamObject` + zod schema) |
| **Native function calling** | The chat advisor calls a `getWeather` tool (Open-Meteo, Ogbomoso coordinates) before advising on spraying |
| **Multilingual (140+ languages)** | Yorùbá summaries with correct diacritics, and the chat replies in Yorùbá when addressed in it |
Model access is through Vercel AI Gateway with the
AI SDK — one line (`model: "google/gemma-4-31b-it"`) and OIDC auth, no provider
SDK. Point the same code at a local Ollama
endpoint and it runs fully offline on-premise.
## Stack
- Next.js 16 (App Router) + TypeScript + Tailwind CSS 4
- Vercel AI SDK v6 (`streamObject`, `streamText`, tools)
- Gemma 4 31B IT via Vercel AI Gateway
- Open-Meteo API for the weather tool (no key needed)
## Run it locally
```bash
npm install
cp .env.example .env.local # add your AI Gateway key
npm …