title: CropIntel
emoji: πΎ
colorFrom: green
colorTo: blue
sdk: docker
app_port: 3050
pinned: false
CropIntel
Crop leaf-disease classifier for 5 crops (corn, soybean, wheat, rice, tomato), EfficientNetB0 β TensorFlow Lite, served behind a Next.js UI. One Docker container runs the web app and a persistent Python inference service together.
Quick start (run the whole thing)
You do not need Kaggle, training, or any model files β the trained models (~38 MB) are fetched automatically from the GitHub Release on first start.
git clone https://github.com/rakshithj09/CropIntel.git
cd CropIntel
docker compose -f docker-compose.prod.yml up -d --build
curl -fsS http://localhost:3050/api/health # {"web":"ok","inference":{"ready":true,...}}
Open http://localhost:3050. That's it.
Optional environment (drop a .env next to the compose file):
NEXT_PUBLIC_GOOGLE_MAPS_API_KEY=... # only for the outbreak map
CROPINTEL_ADMIN_TOKEN=$(openssl rand -hex 16) # only to guard POST /admin/reload
CROPINTEL_MODELS_URL=... # override the default v1 model bundle
For a real domain + TLS, monitoring, and model promotion/rollback, see docs/DEPLOYMENT.md.
Local development (no Docker)
The web app forwards predictions to the inference service, so run both:
# 1) fetch models once (into ml/models/, gitignored)
pip install -r ml/requirements-inference.txt
export CROPINTEL_MODELS_URL='https://github.com/rakshithj09/CropIntel/releases/download/v1/cropintel-models-mobile.zip'
python3 -m ml.scripts.fetch_models
# 2) start the inference service (terminal A)
python3 -m uvicorn ml.serve.inference_app:app --host 127.0.0.1 --port 8000
# 3) start the web app (terminal B)
npm install && npm run dev
Open http://localhost:3050. The UI calls /api/predict,
which forwards to the inference service at INFERENCE_URL (default
http://127.0.0.1:8000).
Train it yourself (needs Kaggle data)
See ml/README.md for the Kaggle API setup and training scripts
(pip install -r ml/requirements.txt). Models are gated on an external
(out-of-distribution) eval before promotion β see
ml/scripts/test_external.py and ml/scripts/promote_model.py.
Maintainer: ship updated models
After training/promoting, repackage and replace the release bundle:
python3 -m ml.scripts.package_models --tflite-only -o cropintel-models-mobile.zip
gh release upload v1 cropintel-models-mobile.zip -R rakshithj09/CropIntel --clobber
# on a running server: rm ml/models/.cropintel-fetch-ok && docker compose -f docker-compose.prod.yml restart
Project layout
app/β Next.js UI +/api/predict(forwards to the inference service) +/api/healthml/serve/inference_app.pyβ FastAPI inference service (loads every crop model once)ml/β training (training/), predictors (inference/), config, scriptsdocker-compose.prod.yml,docker/,docs/DEPLOYMENT.mdβ production deploytests/β pytest suite (.github/workflows/ci.ymlruns web + Python checks)
License
See repository.