crop-classifier-api / README.md
Your Name
Add HF search tags and link to portal
8becebc
|
Raw
History Blame Contribute Delete
2.39 kB
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