Logo Lanfrica

admasfeleke/smart-farming-inference

Domain:

agriculture

Record type:

software
Creator:
adm
Host:
Smart Farming Ethiopia smart-farming-inference # Smart Farming Ethiopia Inference Service Python inference service for crop leaf disease detection in the Smart Farming Ethiopia system. This service is intentionally separated from the Laravel backend because model runtime dependencies, image preprocessing, model files, and CPU/GPU deployment concerns should not live inside the PHP application. ## Related Components - Flutter mobile app: `C:\Users\Admas\smart_farm` - Laravel backend: `C:\dev\smart-farming` - Inference service: `C:\dev\smart-farming-inference` ## Runtime Contract Health endpoint: ```text GET /health ``` Prediction endpoint: ```text POST /predict ``` Expected multipart fields: - `image`: uploaded leaf image - `crop_id`: numeric crop id from Laravel - `selected_crop`: crop name selected by the farmer The response should preserve canonical model labels and provide confidence/risk metadata. Farmer-facing localization should happen in the app/backend display layer, not by changing raw model labels. ## Quick Start ```powershell cd C:\dev\smart-farming-inference python -m venv .venv .\.venv\Scripts\Activate.ps1 pip install -r requirements.txt copy .env.example .env pip install ai-edge-litert python -m uvicorn app.main:app --host 127.0.0.1 --port 9010 --reload ``` If `ai-edge-litert` is not compatible with the installed Python runtime, install TensorFlow and the service can use `tensorflow.lite` instead. ## Laravel Configuration In the Laravel `.env`: ```dotenv INFERENCE_ENABLED=true INFERENCE_BASE_URL=127.0.0.1 INFERENCE_ENDPOINT=/predict INFERENCE_HEALTH_ENDPOINT=/health INFERENCE_TIMEOUT_SECONDS=15 INFERENCE_REVIEW_ONLY_MODE=false ``` If `INFERENCE_TOKEN` is set in Laravel, set the same token in this service `.env`. ## Model Configuration Crop-specific models are configured in: ```text config/models.json ``` Expected local model layout: ```text models/ tomato_v1/ model.tflite labels.json manifest.json potato_v1/ pepper_v1/ maize_v1/ ``` Model binaries and datasets ca …