apiagrilens / README.md
Sidoineko's picture
Fix Dockerfile and README: update MODEL_ID to google/gemma-3n-E4B-it and optimize environment variables
71786b7
---
title: AgriLens AI FastAPI
emoji: 🌱
colorFrom: green
colorTo: blue
sdk: docker
app_port: 7860
tags:
- fastapi
- agriculture
- ai
- plant-disease
pinned: false
short_description: AI-powered plant disease diagnosis API using Gemma-3n model
license: mit
---
# AgriLens AI FastAPI
AI-powered plant disease diagnosis API using Google's Gemma-3n model.
## Features
- Plant disease diagnosis from leaf images
- RESTful API endpoints
- Model sharing with Streamlit application
- CORS enabled for cross-origin requests
## API Endpoints
- `GET /` - API status and information
- `GET /health` - Health check
- `POST /load` - Load the AI model
- `POST /diagnose` - Diagnose plant disease from image
## Usage
### Health Check
```bash
curl https://huggingface.co/spaces/sido1991/apiagrilens/health
```
### Load Model
```bash
curl -X POST https://huggingface.co/spaces/sido1991/apiagrilens/load
```
### Diagnose Plant Disease
```bash
curl -X POST \
-F "image=@plant_leaf.jpg" \
-F "culture=tomato" \
-F "notes=Yellow spots on leaves" \
https://huggingface.co/spaces/sido1991/apiagrilens/diagnose
```
## Configuration
### Variables d'environnement
- **Model**: google/gemma-3n-E4B-it
- **Device**: CPU (optimisé pour Hugging Face Spaces)
- **Max Tokens**: 256
- **Cache Directory**: /tmp/hf_home
### Variables configurables
- `MODEL_ID`: Model identifier (default: google/gemma-3n-E4B-it)
- `DEVICE_MAP`: Device mapping (default: cpu)
- `MAX_NEW_TOKENS`: Maximum new tokens for generation (default: 256)
- `HF_HOME`: Hugging Face cache directory (default: /tmp/hf_home)