SOIL-BACKEND / README.md
djx007's picture
Rename HF_README.md to README.md
773c4ea verified
|
Raw
History Blame Contribute Delete
2.08 kB
metadata
title: Soil Classification Backend
emoji: 🌱
colorFrom: green
colorTo: yellow
sdk: docker
app_port: 7860
pinned: false
license: mit
tags:
  - soil-classification
  - cnn
  - fastapi
  - agriculture
  - tensorflow
  - crop-recommendation
short_description: Classify soil types from images and get crop recommendations

🌱 Soil Classification Backend

AI-powered soil image classifier built with FastAPI + TensorFlow. Upload a photo of soil and instantly receive:

  • 🏷️ Soil type β€” one of Black Β· Clayey Β· Loamy Β· Red Β· Sandy
  • 🌾 Crop recommendations β€” sourced from 8 000+ soil-to-crop mappings
  • 🌐 Multilingual explanations β€” English, Hindi, and Odia

πŸ”Œ API

POST /api/classify

Request

{
  "imageBase64": "data:image/jpeg;base64,...",
  "language": "English"
}

Response

{
  "soilType": "Sandy",
  "explanation": "This soil appears to be Sandy soil...",
  "recommendedCrops": ["Barley", "Maize", "Millets"]
}

GET /

Health check β€” returns model status and supported soil classes.


🧠 Model

Architecture CNN (Convolutional Neural Network)
Framework TensorFlow / Keras 2.16
Input 224 Γ— 224 RGB image
Classes Black, Clayey, Loamy, Red, Sandy

πŸ› οΈ Stack

Web Framework FastAPI
ML TensorFlow 2.16 (CPU)
Image Processing Pillow
Data pandas + CSV (8 000+ crop mappings)
Server Uvicorn
Container Docker

πŸ“‚ Files

β”œβ”€β”€ app.py               # FastAPI app + CNN inference
β”œβ”€β”€ Dockerfile            # Docker build
β”œβ”€β”€ requirements.txt      # Python deps
β”œβ”€β”€ model/
β”‚   └── soil_model007.keras
└── data/
    └── data_core.csv     # Soil β†’ Crop mapping

🌍 Languages Supported

Language Code
English "English"
Hindi "Hindi"
Odia "Odia"

Made with ❀️ for Indian agriculture · NIELIT Internship