📱 Mobile app: GblackAI Mobile
An AI-powered API that analyzes farm images to detect diseases, pests, and crop problems.
- Detect diseases and pests on plants (close-up photos)
- Analyze farm fields from satellite or drone images
- Return structured recommendations (biological, chemical, cultural)
GblackAI-API/
│
├── main.py # API v12 — production version
├── main2.py # API v8.5 — reference version
│
├── app/
│ ├── config.py # Environment variables and constants
│ ├── models.py # Pydantic schemas (requests / responses)
│ ├── prompts.py # AI prompts (Plant, Satellite, Drone)
│ ├── key_manager.py # Gemini API key rotation
│ └── services/
│ ├── gemini.py # Gemini API calls with error handling
│ └── cloudinary.py # Crop and upload to Cloudinary
│
├── tests/
│ ├── conftest.py # Test fixtures
│ └── test_api.py # Endpoint and module tests
│
├── Dockerfile
├── .env.example # Environment variables template
├── requirements.txt
| Version | File | Endpoint | Description |
|---|---|---|---|
| v12 | main.py |
/api/v12/analyze |
Modular architecture, 3 specialized prompts |
| v8.5 | main2.py |
/api/v8/analyze-image |
Reference version, universal prompt |
| Type | Description |
|---|---|
PLANT_PEST |
Close-up photo — leaves, stems, insects |
SATELLITE_REMOTE_SENSING |
Satellite images (Sentinel-2, Landsat) |
DRONE_ANALYSIS |
High-resolution drone orthophotos |
| Tool | Role |
|---|---|
| FastAPI | REST API framework |
| Gemini 3 Flash Preview | Multimodal AI model (vision + text) |
| Cloudinary | Store detected zone crops |
| Pydantic | JSON validation |
| slowapi | Rate limiting — 15 req/min |
| Docker | Containerization |
| pytest | Tests |
git clone https://github.com/Gblack98/GblackAI-API.git
cd GblackAI-APIpython -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activatepip install -r requirements.txtcp .env.example .env
# Fill in the values in .envuvicorn main:app --reload --port 8000Interactive docs available at http://localhost:8000/docs
docker build -t gblackai-api .
docker run -p 8000:8000 --env-file .env gblackai-api| Variable | Description |
|---|---|
GEMINI_API_KEYS |
Gemini keys separated by commas (key1,key2,key3) |
CLOUDINARY_CLOUD_NAME |
Cloudinary cloud name |
CLOUDINARY_API_KEY |
Cloudinary API key |
CLOUDINARY_API_SECRET |
Cloudinary secret |
KeyManagerautomatically switches to the next key when the quota is exceeded.
pytest tests/ -vTests mock Gemini and Cloudinary — no real keys needed.
curl -X POST "http://localhost:8000/api/v12/analyze" \
-F "analysis_type=PLANT_PEST" \
-F "file=@leaf.jpg"Response:
{
"subject": {
"subjectType": "PLANT",
"description": "Maize plant (Zea mays)",
"confidence": 0.96
},
"detections": [
{
"className": "Common rust of maize",
"confidenceScore": 0.89,
"severity": "HIGH",
"boundingBox": { "x_min": 0.1, "y_min": 0.2, "x_max": 0.6, "y_max": 0.7 },
"croppedImageUrl": "https://res.cloudinary.com/...",
"details": {
"description": "Orange spots on leaves.",
"impact": "Yield will decrease if nothing is done.",
"recommendations": {
"biological": [],
"chemical": [],
"cultural": []
},
"knowledgeBaseTags": ["rust", "maize", "fungus"]
}
}
]
}This app is for informational purposes only. The analysis and recommendations provided are generated by an AI model and should not replace the advice of a qualified agronomist. Always consult a professional before applying any treatment to your crops.
Image data is processed by Google Gemini and stored on Cloudinary. By using this project, you accept Google AI Studio's Terms of Service and Cloudinary's Terms of Service. The free tier of Google AI Studio is intended for non-commercial use only.
Gblack98 — github.com/Gblack98