Logo Lanfrica

mahingaRodin/AgroSenseAi-be

Domain:

agriculture

Record type:

software
Creator:
mah
Host:
Smart Soil & Crop Health Advisor for African Farmers # 🌱 AgroSenseAI Backend - Crop Disease & Pest Detection API This is the **backend service** of AgroSenseAI β€” a smart agriculture system that leverages machine learning to help farmers detect crop diseases and pests from images, and optionally analyze soil fertility using NPK sensor data. Built with **FastAPI** and **PyTorch**, this backend provides clean and ready-to-use APIs to power modern precision farming solutions. ## πŸš€ Features - 🧠 **Crop Disease & Pest Detection** using ML models - πŸ“€ **Image Upload API** with predictions in JSON - πŸ“¦ **Dockerized** for easy deployment - πŸ“š **Auto-generated API docs** via Swagger (FastAPI) ## 🧰 Backend Tech Stack - **Backend Framework**: FastAPI - **Machine Learning**: PyTorch, Torchvision - **Image Handling**: Pillow - **API Validation**: Pydantic - **Containerization**: Docker - **Deployment**: Render, Railway, or any Docker-supported cloud ## πŸ“ Project Structure app/ β”œβ”€β”€ main.py # FastAPI entry point β”œβ”€β”€ routes/ # API route handlers β”œβ”€β”€ services/ # Model prediction logic β”œβ”€β”€ models/ # Saved ML model files β”œβ”€β”€ utils/ # Preprocessing tools β”œβ”€β”€ requirements.txt # Python dependencies β”œβ”€β”€ Dockerfile # Docker container setup └── README.md # Project documentation ## πŸ”Œ API Endpoints | Method | Endpoint | Description | | ------ | ----------------- | --------------------------------- | | POST | `/disease/detect` | Detect crop disease from an image | | POST | `/pest/detect` | Detect pests from a crop image | | GET | `/docs` | Swagger UI (API documentation) | > All image uploads should be sent as `multipart/form-data` ## 🐳 Run with Docker ```bash # Build Docker image docker build -t agrosenseai-backend . # Run container locally docker run -p 8000:8000 agrosenseai-backend ``` API available at: πŸ‘‰ localhost --- ## πŸ“¦ Run Locally Without Docker ```bash git clone github.com cd agrosense-backend pi …