Spaces:
Sleeping
Sleeping
File size: 2,385 Bytes
441e215 5354624 441e215 5354624 8becebc 441e215 5354624 f3d5e99 5354624 8becebc 5354624 8becebc 5354624 f3d5e99 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | ---
title: Crop Classifier API
emoji: πΎ
colorFrom: green
colorTo: yellow
sdk: docker
pinned: false
app_port: 7860
tags:
- agriculture
- computer-vision
- image-classification
- api
- fast-api
- farming
short_description: Free REST API to classify 50 crop varieties from images.
---
# πΎ Crop Classifier API
AI-powered REST API that classifies **50 crop varieties** from images using EfficientNetB3 (93.48% accuracy) + LLaMA-3.2-90B Vision expert verification.
## π Get your free API Key
**π [Click here to generate your free API Key](https://vdx-0-crop-classifier-api.hf.space/portal)** π
Generate a completely free, unique API key instantly. No approval needed.
---
## π‘ Base URL
```
https://vdx-0-crop-classifier-api.hf.space
```
## π Quick Start
### JavaScript
```javascript
const formData = new FormData();
formData.append("file", imageFile); // your image file
const response = await fetch("https://vdx-0-crop-classifier-api.hf.space/predict", {
method: "POST",
headers: { "x-api-key": "YOUR_API_KEY_HERE" },
body: formData
});
const result = await response.json();
console.log(result.final_answer.crop_name); // "Wheat"
console.log(result.final_answer.quality); // "Excellent"
console.log(result.final_answer.explanation); // "Full description..."
```
### Python
```python
import requests
with open("crop.jpg", "rb") as f:
res = requests.post(
"https://vdx-0-crop-classifier-api.hf.space/predict",
headers={"x-api-key": "YOUR_API_KEY_HERE"},
files={"file": f}
)
print(res.json()["final_answer"])
```
### cURL
```bash
curl -X POST "https://vdx-0-crop-classifier-api.hf.space/predict" \
-H "x-api-key: YOUR_API_KEY_HERE" \
-F "file=@crop_image.jpg"
```
---
## π¦ Response Example
```json
{
"final_answer": {
"crop_name": "Wheat",
"quality": "Excellent",
"market_grade": "Grade A",
"characteristics": "Golden stalks with dry grain heads...",
"explanation": "High quality mature wheat crop...",
"storage_tip": "Store in cool, dry place in sealed bags",
"confidence_label": "High"
}
}
```
## β‘ Endpoints
| Endpoint | Description |
|---|---|
| `POST /predict` | Full analysis (model + AI expert) |
| `POST /predict/fast` | Model only, instant response |
| `GET /crops` | List all 50 supported crops |
| `GET /docs` | Interactive API documentation |
|