This project is an AI-based pest detection system(Pest Shield Ghana) specifically designed to help Ghanaian farmers. This mobile application project aims to create an intelligent tool that enables farmers to quickly and accurately identify pests from images captured on mobile devices.
# Pest Shield Ghana — Group 26B
A Flutter mobile app with a Python FastAPI backend for pest detection and analysis using computer vision.
## Project Structure
```
pest_shield_app/
├── frontend/ # Flutter mobile app
│ ├── lib/ # Flutter Dart code
│ ├── android/ # Android native configs
│ ├── ios/ # iOS native configs
│ ├── pubspec.yaml # Flutter dependencies
│ └── assets/ # App images and resources
├── backend/ # Python FastAPI server
│ ├── main.py # FastAPI app with /analyze-pest endpoint
│ ├── requirements.txt
│ └── .env.example # Environment variables template
├── .gitignore
└── README.md
```
## Quick Start
### Backend Setup
1. **Install Python dependencies:**
```bash
cd backend
pip install -r requirements.txt
```
2. **Configure API Key:**
```bash
cp .env.example .env
# Edit .env and add your OPENROUTER_API_KEY
```
3. **Run the API:**
```bash
uvicorn main:app --reload --host 0.0.0.0 --port 8000
```
The API will be available at `
localhost`
### Frontend Setup
1. **Install Flutter & Dependencies:**
```bash
cd frontend
flutter pub get
```
2. **Configure API Base URL (Optional):**
By default connects to `
api-pest.onrender.com`.
For local development:
```bash
flutter run --dart-define=API_BASE_URL=
your-machine-ip
```
3. **Run the App:**
```bash
# For Android
flutter run
# For iOS
flutter run -d iphone
# For Web
flutter run -d chrome
```
## Features
- **Capture/Upload** pest images from camera or gallery
- **AI Analysis** using OpenRouter vision API
- **Pest Detection** with confidence scores
- **Smart Suggestions** for pest management
- **Multi-device** support (Android, iOS, Web)
## API Endpoints
### `POST /analyze-pest`
Analyzes an uploaded image and returns pest information.
**Request:**
- `file` (multipart): Image file (JPEG/PNG)
**Response:**
```json …