Made with π by Lumi
See plant disease from a photo Β· Sense weather, soil & markets Β· Recommend fertilizer blends, crop rotation, what-to-plant & irrigation Β· Converse with a configurable BYOK AI assistant that ingests live data on the fly.
React + FastAPI + Python ML Β· only free / open data Β· runs with zero secrets via ./start.sh or docker compose up
| Pillar | Capability | How |
|---|---|---|
| π¬ COPILOT | A generative-UI workspace β the agent renders charts/tables/maps inline & in a preview pane; persisted multi-conversation history | CopilotKit + BYOK LLM (MiniMax-M3 + OpenAI/Anthropic/Gemini/Ollama) |
| πΊοΈ MAP | Draw & save field boundaries on satellite imagery Β· field-health (veg-index) & USDA crop-type overlays Β· field-boundary detection | MapLibre + Terra Draw Β· ESRI World Imagery Β· USDA CDL Β· OpenCV |
| ποΈ SEE | Plant-disease ID from leaf / field / aerial images & video | Local MobileNetV2 CNN (PlantVillage) + LLM-vision (auto-routed) |
| π‘ SENSE | Live weather, soil moisture/temp, ET0, crop & fertilizer prices | Open-Meteo Β· USDA NASS Β· World Bank Pink Sheet Β· SSURGO/SoilGrids |
| π§ͺ RECOMMEND | Fertilizer raw-material blend Β· crop rotation Β· what-to-plant Β· irrigation Β· fertilizer buy-timing | Deterministic agronomy (FAO-56, blend math) + ML + SARIMAX |
| 𧬠GENOMICS | Genomic-selection breeding sim β predict yield/traits (GEBV) Β· design the best crosses Β· forecast genetic gain Β· balance trait trade-offs; animated pipeline + Copilot Q&A over every run | rrBLUP Β· GBLUP Β· RandomForest Β· deep MLP (numpy + scikit-learn) on CropGS-style data |
| π SUPPLY CHAIN | Fleet routing optimization on real roads β assign trucks across farms/packhouses/cold-storage/DCs/markets respecting capacity + cold-chain time limits, traced on the live road network, with the bottleneck hub flagged | OSMnx/OpenStreetMap (road network) Β· OR-Tools VRP Β· city2graph (supply-network graph) |
- Python 3.11+ and Node 20+ (with
npm) β for the script / manual run - Docker + Docker Compose β only for the Docker run
- (optional) Ollama for a free local LLM; (optional) a cloud LLM key (MiniMax / OpenAI / Anthropic / Gemini)
No API keys are required to start β the app boots with zero secrets.
git clone https://github.com/CES-Ltd/cropPilot.git && cd cropPilot ./start.sh # 1st run: sets up venv + npm; then starts all 3 services (backend + runtime + frontend) ./start.sh --with-cnn # same, but also installs the local pre-trained disease CNN (transformers+torch, ~2 GB)
start.sh auto-picks free ports (so it won't clash with anything already on :8000/:5173) and
prints the actual URLs β watch the console, e.g.:
π backend β http://localhost:8000 (docs: /docs)
π frontend β http://localhost:5173
Open the frontend URL it prints. Ctrl-C stops both. (make start does the same thing.)
cp .env.example .env # optional β app boots with zero secrets docker compose up --build # frontend :5173 Β· backend :8000 Β· docs at :8000/docs docker compose down # stop
# terminal 1 β backend cd backend && python3 -m venv .venv && . .venv/bin/activate pip install -r requirements.txt # add: -r requirements-ml.txt for the local CNN uvicorn app.main:app --reload --port 8000 # terminal 2 β frontend cd frontend && npm install npm run dev # http://localhost:5173 # if the backend isn't on :8000, point the UI at it: VITE_API_BASE=http://localhost:8001 npm run dev
Interactive API docs (Swagger) are always at <backend-url>/docs.
- MiniMax-M3 (default cloud option) β text + image + video; paste your key, endpoint
api.minimax.io/v1. - OpenAI / Anthropic / Gemini β paste your key.
- Ollama (local, zero-cost):
ollama pull llama3.1 && ollama pull llama3.2-vision. Running locally (script/manual, not Docker)? Set the Ollama base URL tohttp://localhost:11434in Settings β Providers (thehost.docker.internaldefault is for the Docker run).
The local CNN uses a pre-trained Hugging Face PlantVillage model (auto-downloads & caches on first use, no key).
Enable it with ./start.sh --with-cnn or pip install -r backend/requirements-ml.txt. Without it,
disease ID still works via LLM-vision. (To train your own instead, see ml/ + scripts/train_disease.sh.)
Add your USDA NASS key in-app to enable live crop production / demand signals (Fernet-encrypted at rest).
Where keys are stored: saved BYOK/data keys are Fernet-encrypted in
backend/.cropilot/(git-ignored) and persist across restarts β for both./start.shand Docker (it's bind-mounted, so the same store is shared and survivesdocker compose down).make cleandoes not delete it. PinCROPILOT_SECRET_KEYin.envif you reset that folder or deploy across multiple hosts.
frontend/ Vite + React + TS + Tailwind + recharts + CopilotKit + MapLibre
src/pages/Workspace.tsx 3-pane generative-UI copilot (history | chat | preview)
src/pages/FieldMap.tsx MapLibre satellite map: draw fields, overlays, detection
src/components/copilot/ generative actions + artifact cards + preview pane
runtime/ Node CopilotKit runtime sidecar β proxies the chat to your BYOK LLM
backend/ FastAPI
app/routers/ disease, crops, fertilizer, irrigation, prices, assistant, gis, conversations, settings, internal
app/services/ agronomy engines, ML, GIS analysis, LiteLLM provider layer, persisted stores
app/data_services/ cached clients for every free data source (Open-Meteo, NASS, World Bank, SoilGrids...)
ml/ offline training pipeline (MobileNetV2 on PlantVillage) β optional
seed/ committed offline fixtures (weather snapshot, Pink Sheet xlsx)
The Copilot runs as three processes (frontend + FastAPI backend + Node runtime); ./start.sh
and docker compose up launch all three. The runtime reads your active BYOK key from the backend's
localhost-guarded /internal endpoint β your key is never stored in the runtime or the browser.
See DATA_SOURCES.md for the full data-source list, licenses, and attribution.
Big datasets and trained binaries are not committed β they're fetched on demand:
scripts/setup_data.sh # (optional) download PlantVillage + refresh the Pink Sheet snapshot + Kaggle CSVs scripts/train_disease.sh # (optional) train your OWN MobileNetV2 on PlantVillage scripts/download_models.sh # (optional) pull a trained model you published to a GitHub Release
You usually don't need any of these: the disease CNN uses a pre-trained Hugging Face model that
downloads automatically, the Pink Sheet ships as a committed snapshot in seed/, and the crop-recommendation
CSV is vendored. The scripts are only for refreshing data or training your own model.
Built in phases β see the in-repo plan. Each phase is independently runnable via docker compose up.
- Phase 0 β scaffold
- Phase 1 β four pillars (zero paid deps)
- Phase 2 β disease CNN + auto-routing
- Phase 3 β data depth + crop-recommend + plant-now
- Phase 4 β rotation + irrigation + assistant tools
- Phase 5 β price prediction + buy-timing
- Phase 6 β polish, BYOK security (Fernet), tests, offline seed fixtures
- v2 β CopilotKit generative-UI workspace Β· persisted conversations Β· GIS field mapping (MapLibre, draw boundaries, CDL + field-health overlays, boundary detection) Β· modern slate+indigo redesign
- v3 β Genomics & breeding simulation (genomic selection: rrBLUP/GBLUP/RandomForest/MLP Β· GEBV Β· crossing design Β· genetic-gain forecast Β· trait trade-offs Β· animated pipeline Β· Copilot Q&A over saved experiments)
- v4 β Supply-chain routing (real-road fleet VRP: OSMnx/OpenStreetMap network Β· OR-Tools capacity + cold-chain time-window optimization Β· city2graph supply-network graph + bottleneck hub Β· MapLibre route map Β· Copilot
planSupplyRoutes)
| Page | What it does | Free data / model |
|---|---|---|
| Copilot | Generative-UI chat β renders blend/price/irrigation/crop/map cards inline & in a preview pane; persisted history | CopilotKit + BYOK LLM |
| Field Map | Draw/save field boundaries on satellite; field-health & USDA crop-type overlays; boundary detection | MapLibre Β· Terra Draw Β· ESRI Β· USDA CDL Β· OpenCV |
| Dashboard | Live weather, soil moisture/temp, ET0 vs rainfall chart | Open-Meteo |
| Disease ID | Leaf diagnosis (CNNβLLM auto) + aerial field-health veg-index map | PlantVillage CNN Β· LLM-vision Β· ExG/VARI/GLI |
| Fertilizer Blend | Soil NPK β raw-material blend (PβKβN), berry-aware | deterministic agronomy math |
| Crop Rotation | Previous crop β next-crop ranking + N-credit | rule engine (editable YAML) |
| What to Plant | Seasonal suggestions + ML NPKβcrop recommender | RandomForest Β· phzmapi Β· NASS |
| Irrigation | FAO-56 ETc = Kc Γγ°γ€ ET0 water-balance schedule | Open-Meteo ET0 |
| Markets & Buy-Timing | Fertilizer price forecast + best-time-to-buy | World Bank Pink Sheet Β· SARIMAX |
| Genomics | Genomic-selection breeding sim: predict GEBV Β· design best crosses Β· genetic-gain forecast Β· trait trade-offs β animated pipeline + plain-language reports | rrBLUP Β· GBLUP Β· RandomForest Β· MLP (numpy/scikit-learn) Β· CropGS-style data |
| Supply Chain | Fleet routing on real roads: assign trucks across facilities with capacity + cold-chain limits, draw routes on the map, flag the bottleneck hub | OSMnx/OpenStreetMap Β· OR-Tools VRP Β· city2graph |
- Open Supply Chain in the sidebar. A demo facility network (depot, farms, packhouse, cold storage, supplier, market in Monterey County) loads on a real road map.
- Set the trucks, capacity per truck, and cold-chain limit (max minutes per route), then Optimize fleet routes. Each truck's route is drawn on the actual road network, color-coded, with a plan card (stops in order, load, distance, time, cost).
- Tighten the inputs (fewer trucks, lower capacity, shorter cold-chain) and re-run β the optimizer will flag stops it can't serve within the limits so you know when you need another truck.
- Add your own facilities (click the map to drop a location) or delete the demo ones.
- Ask the Copilot: "plan the delivery routes with 4 trucks" β it runs the optimizer and renders the plan inline.
The road network is OpenStreetMap (no API key); a small demo graph is committed so it works offline, and any other region is fetched live on demand. Travel times/costs are estimates for decision-support. Refresh or extend the demo network with
scripts/fetch_osm_graph.py.
- Open Genomics in the sidebar. The bundled Rice (CropGS-style demo) panel loads automatically (400 lines Γγ°γ€ 4,000 SNPs, 5 correlated traits incl. yield).
- Predict (GEBV) β pick a trait β ranks lines by genomic breeding value and compares the four models' cross-validated accuracy (linear GS typically wins on small data; the deep MLP is shown for honesty).
- Design crosses β pick two parents β simulates 200 doubled-haploid progeny and shows the predicted trait distribution + chance of beating the elite check.
- Crossing design β ranks the best parent pairs by usefulness (mid-parent GEBV + selection on segregation variance).
- Genetic gain β forecasts multi-cycle recurrent-selection gain (the rising curve).
- Trade-offs β builds a multi-trait selection index and plots the trait trade-off scatter.
- Every run is saved as an experiment; ask the Copilot things like "design the best crosses for yield" or "summarize the results of my best cross" β it runs the pipeline and answers grounded in your saved runs.
GEBV/accuracy are model estimates on demo data β decision-support, not guarantees. The demo panel is synthesized CropGS-style (deterministic) for instant offline use; real CropGS-Hub data or your own genotype/phenotype CSVs load through the same pipeline. Methodology & attribution:
DATA_SOURCES.md.
cd backend && . .venv/bin/activate && pip install -r requirements-dev.txt && pytest # 28 engine + API + genomics + supply-chain tests cd frontend && npm run build # typecheck + build
MIT (code). Data sources retain their own licenses β see DATA_SOURCES.md.
Weather data by Open-Meteo.com (CC BY 4.0).