Spaces:
Sleeping
Sleeping
metadata
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 π
Generate a completely free, unique API key instantly. No approval needed.
π‘ Base URL
https://vdx-0-crop-classifier-api.hf.space
π Quick Start
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
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
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
{
"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 |