GodfreyOwino commited on
Commit
7702feb
·
0 Parent(s):

Initial commit: Smart Fertilizer Recommender API with LFS

Browse files
.gitattributes ADDED
@@ -0,0 +1 @@
 
 
1
+ *.pkl filter=lfs diff=lfs merge=lfs -text
Dockerfile ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.9-slim
2
+
3
+ WORKDIR /app
4
+
5
+ # Copy requirements first for better caching
6
+ COPY requirements.txt .
7
+ RUN pip install --no-cache-dir -r requirements.txt
8
+
9
+ # Copy all files
10
+ COPY . .
11
+
12
+ # Expose the port
13
+ EXPOSE 7860
14
+
15
+ # Command to run the FastAPI app
16
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
README.md ADDED
@@ -0,0 +1,154 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Smart Fertilizer Recommender API
3
+ emoji: 🌾
4
+ colorFrom: green
5
+ colorTo: blue
6
+ sdk: docker
7
+ pinned: false
8
+ license: mit
9
+ short_description: AI-powered fertilizer recommendations for crops
10
+ ---
11
+
12
+ # 🌾 Smart Fertilizer Recommender API
13
+
14
+ A FastAPI-based REST API that provides intelligent fertilizer recommendations using a Random Forest machine learning model. The system analyzes soil nutrient parameters and crop type to suggest the most suitable fertilizer.
15
+
16
+ ## 🚀 Features
17
+
18
+ - **Intelligent Recommendations**: ML-powered fertilizer suggestions based on soil analysis
19
+ - **Multi-Crop Support**: Recommendations for various crop types
20
+ - **Confidence Scoring**: Each recommendation comes with a confidence percentage
21
+ - **Input Validation**: Automatic validation of soil parameter ranges
22
+ - **Batch Processing**: Process multiple soil samples at once
23
+ - **Interactive Documentation**: Built-in Swagger UI for easy testing
24
+
25
+ ## 🔬 Model Information
26
+
27
+ - **Algorithm**: Random Forest Classifier
28
+ - **Features**: Nitrogen %, Phosphorus (Olsen) ppm, Potassium meq%, Soil pH, Crop Type
29
+ - **Training Accuracy**: ~95%+
30
+ - **Cross-Validation**: 5-fold CV for robust evaluation
31
+
32
+ ## 📊 API Endpoints
33
+
34
+ ### Core Endpoints
35
+
36
+ - `GET /` - Welcome message and API information
37
+ - `GET /health` - Health check endpoint
38
+ - `GET /model-info` - Model performance metrics and details
39
+ - `GET /crops` - List of supported crops
40
+ - `GET /fertilizers` - List of available fertilizers
41
+
42
+ ### Prediction Endpoints
43
+
44
+ - `POST /predict` - Single fertilizer recommendation
45
+ - `POST /batch-predict` - Batch processing for multiple samples
46
+
47
+ ### Utility Endpoints
48
+
49
+ - `GET /docs` - Interactive Swagger documentation
50
+ - `GET /redoc` - Alternative API documentation
51
+ - `GET /debug/files` - Debug information
52
+
53
+ ## 🔧 Usage Examples
54
+
55
+ ### Single Prediction
56
+
57
+ ```python
58
+ import requests
59
+
60
+ # API endpoint
61
+ url = "https://OwinoGoddy.hf.space/predict"
62
+
63
+ # Soil parameters
64
+ data = {
65
+ "nitrogen_percent": 0.08,
66
+ "phosphorus_ppm": 23.0,
67
+ "soil_ph": 5.76,
68
+ "potassium_meq_percent": 1.36,
69
+ "crop": "maize"
70
+ }
71
+
72
+ # Make prediction
73
+ response = requests.post(url, json=data)
74
+ result = response.json()
75
+
76
+ print(f"Recommended Fertilizer: {result['primary_recommendation']}")
77
+ print(f"Confidence: {result['confidence']}%")
78
+ Response Example
79
+ json{
80
+ "primary_recommendation": "NPK 20-10-10",
81
+ "confidence": 87.5,
82
+ "all_recommendations": [
83
+ {
84
+ "fertilizer": "NPK 20-10-10",
85
+ "confidence": 87.5
86
+ },
87
+ {
88
+ "fertilizer": "DAP",
89
+ "confidence": 8.2
90
+ },
91
+ {
92
+ "fertilizer": "Urea",
93
+ "confidence": 3.1
94
+ }
95
+ ],
96
+ "input_parameters": {
97
+ "nitrogen_percent": 0.08,
98
+ "phosphorus_ppm": 23.0,
99
+ "soil_ph": 5.76,
100
+ "potassium_meq_percent": 1.36,
101
+ "crop": "maize"
102
+ },
103
+ "validation_warnings": []
104
+ }
105
+ 📝 Input Parameters
106
+ ParameterTypeRangeDescriptionnitrogen_percentfloat0-5%Total Nitrogen percentagephosphorus_ppmfloat0-200 ppmPhosphorus Olsen in ppmsoil_phfloat3-10Soil pH levelpotassium_meq_percentfloat0-10%Potassium in meq%cropstring-Crop name (see /crops endpoint)
107
+ 🌱 Supported Crops
108
+ The system supports various crop types including:
109
+
110
+ Maize
111
+ Beans
112
+ Wheat
113
+ Rice
114
+ Sorghum
115
+ And many more...
116
+
117
+ Use the /crops endpoint to get the complete list of supported crops.
118
+ 🔍 Model Validation
119
+ The API includes automatic input validation:
120
+
121
+ Range checking for all numerical parameters
122
+ Statistical validation against training data
123
+ Crop name validation
124
+ Warning system for unusual values
125
+
126
+ 🚀 Getting Started
127
+
128
+ Access the API: Visit the Hugging Face Space URL
129
+ Interactive Testing: Use /docs for Swagger UI
130
+ Get Crops: Check /crops for supported crop types
131
+ Make Predictions: Send POST requests to /predict
132
+
133
+ 📈 Performance Metrics
134
+
135
+ Accuracy: High accuracy on test data
136
+ Speed: Fast predictions (<100ms typical)
137
+ Reliability: Robust error handling and validation
138
+ Scalability: Supports batch processing
139
+
140
+ 🛠️ Technical Stack
141
+
142
+ Backend: FastAPI
143
+ ML Framework: scikit-learn
144
+ Model: Random Forest Classifier
145
+ Validation: Pydantic
146
+ Documentation: Swagger/OpenAPI
147
+ Deployment: Docker + Hugging Face Spaces
148
+
149
+ 📞 Support
150
+ For questions, issues, or feature requests, please visit the Hugging Face Space discussion tab.
151
+ 📄 License
152
+ MIT License - feel free to use this API for your agricultural applications!
153
+
154
+ Built with ❤️ for sustainable agriculture
app.py ADDED
@@ -0,0 +1,431 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from fastapi import FastAPI, HTTPException
2
+ from pydantic import BaseModel, Field
3
+ import pickle
4
+ import numpy as np
5
+ import pandas as pd
6
+ from typing import Dict, List, Any
7
+ import uvicorn
8
+ import os
9
+ import traceback
10
+ import json
11
+
12
+ # Function to list files in current directory
13
+ def list_files():
14
+ """List all files in the current directory"""
15
+ try:
16
+ files = os.listdir('.')
17
+ print("📁 Files in current directory:")
18
+ for file in files:
19
+ file_path = os.path.join('.', file)
20
+ if os.path.isfile(file_path):
21
+ size = os.path.getsize(file_path)
22
+ print(f" 📄 {file} ({size} bytes)")
23
+ else:
24
+ print(f" 📁 {file}/")
25
+ return files
26
+ except Exception as e:
27
+ print(f"Error listing files: {e}")
28
+ return []
29
+
30
+ # Enhanced model loading with debugging
31
+ def load_fertilizer_model():
32
+ """Load the saved fertilizer recommendation model and components"""
33
+ print("🔄 Starting model loading...")
34
+
35
+ # List files first
36
+ files = list_files()
37
+
38
+ # Check if required files exist
39
+ required_files = [
40
+ 'fertilizer_recommendation_model.pkl',
41
+ 'fertilizer_label_encoder.pkl',
42
+ 'crop_label_encoder.pkl',
43
+ 'fertilizer_model_info.pkl'
44
+ ]
45
+
46
+ print(f"\n🔍 Checking for required files:")
47
+ for file in required_files:
48
+ print(f" {file}: {'✅ Found' if file in files else '❌ Missing'}")
49
+
50
+ try:
51
+ # Load model
52
+ with open('fertilizer_recommendation_model.pkl', 'rb') as f:
53
+ model = pickle.load(f)
54
+ print("✅ Model loaded successfully!")
55
+
56
+ # Load fertilizer encoder
57
+ with open('fertilizer_label_encoder.pkl', 'rb') as f:
58
+ fertilizer_encoder = pickle.load(f)
59
+ print("✅ Fertilizer encoder loaded successfully!")
60
+
61
+ # Load crop encoder
62
+ with open('crop_label_encoder.pkl', 'rb') as f:
63
+ crop_encoder = pickle.load(f)
64
+ print("✅ Crop encoder loaded successfully!")
65
+
66
+ # Load model info
67
+ with open('fertilizer_model_info.pkl', 'rb') as f:
68
+ model_info = pickle.load(f)
69
+ print("✅ Model info loaded successfully!")
70
+
71
+ # Try to load feature statistics (optional)
72
+ feature_stats = None
73
+ try:
74
+ with open('feature_statistics.json', 'r') as f:
75
+ feature_stats = json.load(f)
76
+ print("✅ Feature statistics loaded successfully!")
77
+ except:
78
+ print("⚠️ Feature statistics not found (optional)")
79
+
80
+ print(f"📊 Model info: {model_info}")
81
+
82
+ return model, fertilizer_encoder, crop_encoder, model_info, feature_stats
83
+
84
+ except Exception as e:
85
+ print(f"❌ Error loading model: {e}")
86
+ print(f"📍 Full traceback: {traceback.format_exc()}")
87
+ return None, None, None, None, None
88
+
89
+ # Input validation function
90
+ def validate_input_ranges(nitrogen_percent, phosphorus_ppm, potassium_meq_percent, soil_ph, feature_stats=None):
91
+ """Validate if input values are within reasonable ranges"""
92
+ warnings = []
93
+
94
+ # Basic range validation
95
+ if nitrogen_percent < 0 or nitrogen_percent > 5:
96
+ warnings.append(f"Nitrogen percentage {nitrogen_percent} should be between 0-5%")
97
+
98
+ if phosphorus_ppm < 0 or phosphorus_ppm > 200:
99
+ warnings.append(f"Phosphorus {phosphorus_ppm}ppm should be between 0-200ppm")
100
+
101
+ if potassium_meq_percent < 0 or potassium_meq_percent > 10:
102
+ warnings.append(f"Potassium {potassium_meq_percent}meq% should be between 0-10meq%")
103
+
104
+ if soil_ph < 3 or soil_ph > 10:
105
+ warnings.append(f"Soil pH {soil_ph} should be between 3-10")
106
+
107
+ # Advanced validation using training data statistics if available
108
+ if feature_stats:
109
+ try:
110
+ numerical_stats = feature_stats.get('numerical_features', feature_stats)
111
+
112
+ params = {
113
+ 'total_Nitrogen_percent': nitrogen_percent,
114
+ 'phosphorus_Olsen_ppm': phosphorus_ppm,
115
+ 'potassium_meq_percent': potassium_meq_percent,
116
+ 'soil_pH': soil_ph
117
+ }
118
+
119
+ for param_name, value in params.items():
120
+ if param_name in numerical_stats:
121
+ param_stats = numerical_stats[param_name]
122
+ min_val = param_stats['min']
123
+ max_val = param_stats['max']
124
+ mean_val = param_stats['mean']
125
+
126
+ if value < min_val or value > max_val:
127
+ warnings.append(f"{param_name}: {value} is outside training range [{min_val:.2f}, {max_val:.2f}]")
128
+ except Exception as e:
129
+ warnings.append(f"Could not perform advanced validation: {e}")
130
+
131
+ return warnings
132
+
133
+ # Initialize FastAPI app
134
+ app = FastAPI(
135
+ title="🌾 Smart Fertilizer Recommender API",
136
+ description="Predict fertilizer recommendations based on soil nutrient parameters and crop type using Random Forest ML model",
137
+ version="1.0.0",
138
+ docs_url="/docs",
139
+ redoc_url="/redoc"
140
+ )
141
+
142
+ # Load model at startup
143
+ print("🚀 Starting application...")
144
+ model, fertilizer_encoder, crop_encoder, model_info, feature_stats = load_fertilizer_model()
145
+
146
+ # Pydantic models for request/response
147
+ class SoilParameters(BaseModel):
148
+ nitrogen_percent: float = Field(..., ge=0, le=5, description="Total Nitrogen percentage (0-5%)")
149
+ phosphorus_ppm: float = Field(..., ge=0, le=200, description="Phosphorus Olsen in ppm (0-200)")
150
+ soil_ph: float = Field(..., ge=3, le=10, description="Soil pH level (3-10)")
151
+ potassium_meq_percent: float = Field(..., ge=0, le=10, description="Potassium in meq% (0-10%)")
152
+ crop: str = Field(..., description="Crop name (e.g., 'maize', 'beans', 'wheat')")
153
+
154
+ class Config:
155
+ schema_extra = {
156
+ "example": {
157
+ "nitrogen_percent": 0.08,
158
+ "phosphorus_ppm": 23.0,
159
+ "soil_ph": 5.76,
160
+ "potassium_meq_percent": 1.36,
161
+ "crop": "maize"
162
+ }
163
+ }
164
+
165
+ class FertilizerRecommendation(BaseModel):
166
+ fertilizer: str
167
+ confidence: float
168
+
169
+ class PredictionResponse(BaseModel):
170
+ primary_recommendation: str = Field(..., description="Primary fertilizer recommendation")
171
+ confidence: float = Field(..., description="Confidence percentage for primary recommendation")
172
+ all_recommendations: List[FertilizerRecommendation] = Field(..., description="Top 3 fertilizer recommendations with confidence")
173
+ input_parameters: Dict[str, Any] = Field(..., description="Input parameters used for prediction")
174
+ validation_warnings: List[str] = Field(default=[], description="Input validation warnings")
175
+
176
+ class ModelInfoResponse(BaseModel):
177
+ model_name: str
178
+ model_type: str
179
+ train_accuracy: float
180
+ test_accuracy: float
181
+ cv_mean: float
182
+ cv_std: float
183
+ n_classes: int
184
+ fertilizer_classes: List[str]
185
+ crop_classes: List[str]
186
+
187
+ # Add a debug endpoint to check files
188
+ @app.get("/debug/files")
189
+ async def debug_files():
190
+ """Debug endpoint to list all files"""
191
+ files = list_files()
192
+ return {
193
+ "current_directory": os.getcwd(),
194
+ "files": files,
195
+ "model_loaded": model is not None,
196
+ "fertilizer_encoder_loaded": fertilizer_encoder is not None,
197
+ "crop_encoder_loaded": crop_encoder is not None,
198
+ "model_info_loaded": model_info is not None,
199
+ "feature_stats_loaded": feature_stats is not None
200
+ }
201
+
202
+ # API Endpoints
203
+ @app.get("/")
204
+ async def root():
205
+ """Welcome message and API information"""
206
+ return {
207
+ "message": "🌾 Smart Fertilizer Recommender API",
208
+ "description": "Use /predict endpoint to get fertilizer recommendations based on soil parameters and crop type",
209
+ "model": model_info['model_name'] if model_info else "Model not loaded",
210
+ "model_loaded": model is not None,
211
+ "available_crops": crop_encoder.classes_.tolist() if crop_encoder else [],
212
+ "available_fertilizers": len(fertilizer_encoder.classes_) if fertilizer_encoder else 0,
213
+ "docs": "Visit /docs for interactive API documentation",
214
+ "debug": "Visit /debug/files to see available files"
215
+ }
216
+
217
+ @app.get("/health")
218
+ async def health_check():
219
+ """Enhanced health check endpoint"""
220
+ return {
221
+ "status": "healthy",
222
+ "model_loaded": model is not None,
223
+ "encoders_loaded": fertilizer_encoder is not None and crop_encoder is not None,
224
+ "model_info_loaded": model_info is not None,
225
+ "current_directory": os.getcwd(),
226
+ "files_count": len(os.listdir('.')) if os.path.exists('.') else 0
227
+ }
228
+
229
+ @app.get("/model-info", response_model=ModelInfoResponse)
230
+ async def get_model_info():
231
+ """Get information about the trained model"""
232
+ if model_info is None:
233
+ raise HTTPException(status_code=500, detail="Model information not available")
234
+
235
+ return ModelInfoResponse(**model_info)
236
+
237
+ @app.get("/crops")
238
+ async def get_available_crops():
239
+ """Get list of available crops"""
240
+ if crop_encoder is None:
241
+ raise HTTPException(status_code=500, detail="Crop encoder not loaded")
242
+
243
+ return {
244
+ "available_crops": crop_encoder.classes_.tolist(),
245
+ "total_crops": len(crop_encoder.classes_)
246
+ }
247
+
248
+ @app.get("/fertilizers")
249
+ async def get_available_fertilizers():
250
+ """Get list of available fertilizers"""
251
+ if fertilizer_encoder is None:
252
+ raise HTTPException(status_code=500, detail="Fertilizer encoder not loaded")
253
+
254
+ return {
255
+ "available_fertilizers": fertilizer_encoder.classes_.tolist(),
256
+ "total_fertilizers": len(fertilizer_encoder.classes_)
257
+ }
258
+
259
+ @app.post("/predict", response_model=PredictionResponse)
260
+ async def predict_fertilizer(soil_params: SoilParameters):
261
+ """
262
+ Predict fertilizer recommendation based on soil parameters and crop type
263
+
264
+ - **nitrogen_percent**: Total Nitrogen percentage (0-5%)
265
+ - **phosphorus_ppm**: Phosphorus Olsen in ppm (0-200)
266
+ - **soil_ph**: Soil pH level (3-10)
267
+ - **potassium_meq_percent**: Potassium in meq% (0-10%)
268
+ - **crop**: Crop name (use /crops endpoint to see available options)
269
+
270
+ Returns fertilizer recommendation with confidence scores
271
+ """
272
+ if model is None or fertilizer_encoder is None or crop_encoder is None:
273
+ raise HTTPException(
274
+ status_code=500,
275
+ detail={
276
+ "error": "Model components not loaded",
277
+ "debug_info": {
278
+ "model_loaded": model is not None,
279
+ "fertilizer_encoder_loaded": fertilizer_encoder is not None,
280
+ "crop_encoder_loaded": crop_encoder is not None,
281
+ "files_in_directory": os.listdir('.') if os.path.exists('.') else []
282
+ }
283
+ }
284
+ )
285
+
286
+ try:
287
+ # Validate input ranges
288
+ validation_warnings = validate_input_ranges(
289
+ soil_params.nitrogen_percent,
290
+ soil_params.phosphorus_ppm,
291
+ soil_params.potassium_meq_percent,
292
+ soil_params.soil_ph,
293
+ feature_stats
294
+ )
295
+
296
+ # Validate crop name
297
+ if soil_params.crop not in crop_encoder.classes_:
298
+ available_crops = crop_encoder.classes_.tolist()
299
+ raise HTTPException(
300
+ status_code=400,
301
+ detail=f"Unknown crop '{soil_params.crop}'. Available crops: {available_crops}"
302
+ )
303
+
304
+ # Encode crop
305
+ crop_encoded = crop_encoder.transform([soil_params.crop])[0]
306
+
307
+ # Prepare input data (5 features: N, P, K, pH, crop_encoded)
308
+ input_data = np.array([[
309
+ soil_params.nitrogen_percent,
310
+ soil_params.phosphorus_ppm,
311
+ soil_params.potassium_meq_percent,
312
+ soil_params.soil_ph,
313
+ crop_encoded
314
+ ]])
315
+
316
+ # Make prediction
317
+ prediction_encoded = model.predict(input_data)[0]
318
+ prediction_proba = model.predict_proba(input_data)[0]
319
+
320
+ # Decode primary prediction
321
+ predicted_fertilizer = fertilizer_encoder.inverse_transform([prediction_encoded])[0]
322
+
323
+ # Get top 3 recommendations with probabilities
324
+ top_indices = np.argsort(prediction_proba)[::-1][:3]
325
+ recommendations = []
326
+
327
+ for idx in top_indices:
328
+ fertilizer_name = fertilizer_encoder.inverse_transform([idx])[0]
329
+ confidence = prediction_proba[idx] * 100
330
+ recommendations.append(FertilizerRecommendation(
331
+ fertilizer=fertilizer_name,
332
+ confidence=round(confidence, 2)
333
+ ))
334
+
335
+ # Prepare response
336
+ response = PredictionResponse(
337
+ primary_recommendation=predicted_fertilizer,
338
+ confidence=round(max(prediction_proba) * 100, 2),
339
+ all_recommendations=recommendations,
340
+ input_parameters={
341
+ "nitrogen_percent": soil_params.nitrogen_percent,
342
+ "phosphorus_ppm": soil_params.phosphorus_ppm,
343
+ "soil_ph": soil_params.soil_ph,
344
+ "potassium_meq_percent": soil_params.potassium_meq_percent,
345
+ "crop": soil_params.crop
346
+ },
347
+ validation_warnings=validation_warnings
348
+ )
349
+
350
+ return response
351
+
352
+ except HTTPException:
353
+ raise
354
+ except Exception as e:
355
+ print(f"Prediction error: {e}")
356
+ print(f"Traceback: {traceback.format_exc()}")
357
+ raise HTTPException(status_code=400, detail=f"Prediction error: {str(e)}")
358
+
359
+ @app.post("/batch-predict")
360
+ async def batch_predict(soil_samples: List[SoilParameters]):
361
+ """
362
+ Predict fertilizer recommendations for multiple soil samples
363
+ """
364
+ if model is None or fertilizer_encoder is None or crop_encoder is None:
365
+ raise HTTPException(status_code=500, detail="Model components not loaded")
366
+
367
+ if len(soil_samples) > 50:
368
+ raise HTTPException(status_code=400, detail="Maximum 50 samples allowed per batch")
369
+
370
+ try:
371
+ predictions = []
372
+
373
+ for i, sample in enumerate(soil_samples):
374
+ try:
375
+ # Validate crop
376
+ if sample.crop not in crop_encoder.classes_:
377
+ predictions.append({
378
+ "sample_id": i + 1,
379
+ "error": f"Unknown crop '{sample.crop}'"
380
+ })
381
+ continue
382
+
383
+ # Encode crop
384
+ crop_encoded = crop_encoder.transform([sample.crop])[0]
385
+
386
+ # Prepare input data
387
+ input_data = np.array([[
388
+ sample.nitrogen_percent,
389
+ sample.phosphorus_ppm,
390
+ sample.potassium_meq_percent,
391
+ sample.soil_ph,
392
+ crop_encoded
393
+ ]])
394
+
395
+ # Make prediction
396
+ prediction_encoded = model.predict(input_data)[0]
397
+ prediction_proba = model.predict_proba(input_data)[0]
398
+ predicted_fertilizer = fertilizer_encoder.inverse_transform([prediction_encoded])[0]
399
+
400
+ predictions.append({
401
+ "sample_id": i + 1,
402
+ "primary_recommendation": predicted_fertilizer,
403
+ "confidence": round(max(prediction_proba) * 100, 2),
404
+ "input_parameters": {
405
+ "nitrogen_percent": sample.nitrogen_percent,
406
+ "phosphorus_ppm": sample.phosphorus_ppm,
407
+ "soil_ph": sample.soil_ph,
408
+ "potassium_meq_percent": sample.potassium_meq_percent,
409
+ "crop": sample.crop
410
+ }
411
+ })
412
+
413
+ except Exception as e:
414
+ predictions.append({
415
+ "sample_id": i + 1,
416
+ "error": str(e)
417
+ })
418
+
419
+ return {
420
+ "total_samples": len(soil_samples),
421
+ "predictions": predictions
422
+ }
423
+
424
+ except Exception as e:
425
+ print(f"Batch prediction error: {e}")
426
+ print(f"Traceback: {traceback.format_exc()}")
427
+ raise HTTPException(status_code=400, detail=f"Batch prediction error: {str(e)}")
428
+
429
+ # Run the app
430
+ if __name__ == "__main__":
431
+ uvicorn.run(app, host="0.0.0.0", port=7860)
crop_label_encoder.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5e2f893ca58680430b05f9f944cd220ad09789529e7dfe5c576b938b7e714c65
3
+ size 10407
feature_statistics.json ADDED
@@ -0,0 +1,1578 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "numerical_features": {
3
+ "total_Nitrogen_percent": {
4
+ "min": 0.007,
5
+ "max": 2900.0,
6
+ "mean": 0.18904671180652077,
7
+ "std": 9.139741922203353
8
+ },
9
+ "phosphorus_Olsen_ppm": {
10
+ "min": 0.05,
11
+ "max": 624.0,
12
+ "mean": 37.88330509147977,
13
+ "std": 48.696615999686664
14
+ },
15
+ "potassium_meq_percent": {
16
+ "min": 0.01,
17
+ "max": 663.0,
18
+ "mean": 0.8769637822167508,
19
+ "std": 3.744598593287137
20
+ },
21
+ "soil_pH": {
22
+ "min": 3.0,
23
+ "max": 11.2,
24
+ "mean": 6.069050751284503,
25
+ "std": 1.0056002808644966
26
+ }
27
+ },
28
+ "categorical_features": {
29
+ "crop": {
30
+ "unique_crops": [
31
+ "cotton",
32
+ "Maize",
33
+ "Cotton",
34
+ "chickpea",
35
+ "grams",
36
+ "Cow peas",
37
+ "maize",
38
+ "melons",
39
+ "Tomato",
40
+ "onion",
41
+ "cabbage",
42
+ "Capsicum",
43
+ "carrot",
44
+ "kale",
45
+ "beans",
46
+ "Fruit trees",
47
+ "tomato",
48
+ "fruit trees",
49
+ "Rice",
50
+ "butternut",
51
+ "vegetables",
52
+ "Passion fruits",
53
+ "green gram",
54
+ "Grass",
55
+ "Onion",
56
+ "garlic",
57
+ "Mango",
58
+ "Melons",
59
+ "pepper",
60
+ "groundnut",
61
+ "millet",
62
+ "citrus",
63
+ "pawpaw",
64
+ "Kale",
65
+ "mango",
66
+ "Cabbage",
67
+ "Peas",
68
+ "potato",
69
+ "peas",
70
+ "macadamia",
71
+ "Beans",
72
+ "passion fruits",
73
+ "sorghum",
74
+ "Carrot",
75
+ "finger millet",
76
+ "coffee",
77
+ "Potato",
78
+ "avocado",
79
+ "strawberry",
80
+ "black night shade",
81
+ "pasture",
82
+ "spinach",
83
+ "cowpea",
84
+ "napier grass",
85
+ "banana",
86
+ "Sorghum",
87
+ "French beans",
88
+ "ginger",
89
+ "Horticultural",
90
+ "Avocado",
91
+ "grass",
92
+ "Gooseberry",
93
+ "K-apple",
94
+ "tea",
95
+ "Mobydick",
96
+ "Pasture",
97
+ "Vegetables",
98
+ "horticultural crops",
99
+ "french beans",
100
+ "green grams",
101
+ "passion fruit",
102
+ "capsicum",
103
+ "soya beans",
104
+ "cassava",
105
+ "Cassava",
106
+ "groundnuts",
107
+ "Sunflower",
108
+ "sunflower",
109
+ "soya",
110
+ "forage",
111
+ "night shade",
112
+ "Napier grass",
113
+ "Sugar cane",
114
+ "Banana",
115
+ "sukuma wiki",
116
+ "Trees",
117
+ "Chillies",
118
+ "ravaya",
119
+ "aubegine/ ravaya",
120
+ "Horticultural crops",
121
+ "Tomatoes",
122
+ "onions",
123
+ "Maize & Sunflower",
124
+ "Maize & sunflower",
125
+ "mucuna",
126
+ "sweet potato",
127
+ "Coffee",
128
+ "hay",
129
+ "pomegranate",
130
+ "okra",
131
+ "Apples",
132
+ "trees",
133
+ "Bamboo",
134
+ "simsim",
135
+ "Pawpaw",
136
+ "pineapple",
137
+ "Wheat",
138
+ "cereals",
139
+ "sugar cane",
140
+ "groudnuts",
141
+ "bean",
142
+ "Passion fruit",
143
+ "Soya beans",
144
+ "Sweet potato",
145
+ "chilli",
146
+ "cow peas",
147
+ "Millet",
148
+ "tobacco",
149
+ "rice",
150
+ "flowers",
151
+ "Finger millet",
152
+ "horticultural",
153
+ "kei apple",
154
+ "bougainvillea",
155
+ "soybean",
156
+ "Canola",
157
+ "Cereals",
158
+ "grapes",
159
+ "Beetroot",
160
+ "Grapes",
161
+ "Citrus",
162
+ "",
163
+ "Hibiscus",
164
+ "pixie",
165
+ "Mulberry tree",
166
+ "fodder",
167
+ "Agroforestry",
168
+ "Pixie",
169
+ "bixa tree",
170
+ "arborea trees",
171
+ "Legumes",
172
+ "Tree tomato",
173
+ "Citrus trees",
174
+ "orange",
175
+ "Melon",
176
+ "Flowers",
177
+ "oranges",
178
+ "Orange",
179
+ "grevillea",
180
+ "Tea",
181
+ "Macadamia",
182
+ "Dragon fruit",
183
+ "Mulberry",
184
+ "Orange trees",
185
+ "tree tomato",
186
+ "Arabicum flowers",
187
+ "Avocados",
188
+ "Green gram",
189
+ "Eucalyptus trees",
190
+ "coriander",
191
+ "ovacadoes",
192
+ "Garlic",
193
+ "Lemon",
194
+ "Chilli",
195
+ "water melon",
196
+ "sweet melon",
197
+ "Spinach",
198
+ "Berries",
199
+ "Fodder",
200
+ "Groundnut",
201
+ "Cherry",
202
+ "cucumber",
203
+ "lettuce",
204
+ "beans & fodder",
205
+ "Eucalyptus",
206
+ "tubers",
207
+ "herbs",
208
+ "passion",
209
+ "managu",
210
+ "Ginger",
211
+ "saget",
212
+ "mitoo",
213
+ "Cucumber",
214
+ "General crops",
215
+ "legumes",
216
+ "Brassicas",
217
+ "solanaceae",
218
+ "solanaceous",
219
+ "karella",
220
+ "courgettes",
221
+ "Tomatoes and Vegetables",
222
+ "Pomegranate",
223
+ "Strawberry",
224
+ "Spinach & Bulb Onions",
225
+ "khat",
226
+ "Roses",
227
+ "Capsicum and Strawberry",
228
+ "Hortcultural Crops",
229
+ "Cabbage & Onions",
230
+ "water melon & Onions",
231
+ "Gourd",
232
+ "Sugar beet",
233
+ "chillies",
234
+ "Fruit Trees",
235
+ "apples",
236
+ "spider weed",
237
+ "Capsicum & Cabbage",
238
+ "wheat",
239
+ "Vegetables and fruit trees",
240
+ "garden peas",
241
+ "arrow roots",
242
+ "indigenous vegetables",
243
+ "brassicas",
244
+ "garden pea",
245
+ "Green grams",
246
+ "pigeon peas",
247
+ "celery",
248
+ "Beans & Kales",
249
+ "Solanaceous",
250
+ "cucurbits",
251
+ "Cauliflower",
252
+ "baby corn",
253
+ "mushrooms",
254
+ "Aloe vera",
255
+ "brinjals",
256
+ "Courgettes",
257
+ "Tomato & Capsicum",
258
+ "wheat and onion",
259
+ "leeks",
260
+ "sesame",
261
+ "lucerne",
262
+ "Jatropha",
263
+ "Stevia",
264
+ "capsicum and onion",
265
+ "tomatoes and cowpeas",
266
+ "sugar snaps",
267
+ "Managu",
268
+ "Onions",
269
+ "Cowpea",
270
+ "Moringa tree",
271
+ "castor",
272
+ "Herbs",
273
+ "lavender",
274
+ "chives",
275
+ "Mint",
276
+ "rosemary",
277
+ "basil",
278
+ "Cucumber and Capsicum",
279
+ "chinese cabbage and chillies",
280
+ "Broccoli",
281
+ "beetroot",
282
+ "Kales & bulb onions",
283
+ "Sweet corn",
284
+ "Chili",
285
+ "Peppers",
286
+ "arow roots",
287
+ "rhodes grass",
288
+ "jatropha",
289
+ "amaranthus",
290
+ "Soybean",
291
+ "pigeon pea",
292
+ "lupin beans",
293
+ "Pigeon pea",
294
+ "finger millet groundnut",
295
+ "Simsim",
296
+ "black bean",
297
+ "canola",
298
+ "Watermelo",
299
+ "Boma rhodes grass",
300
+ "mashrooms",
301
+ "melons passoin fruit",
302
+ "Passion",
303
+ "snow peas",
304
+ "Capsicum & Spinach",
305
+ "Amaranthus",
306
+ "Pepper & Melon",
307
+ "Basil",
308
+ "Butter nut",
309
+ "Garden pea",
310
+ "apple",
311
+ "Tobacco",
312
+ "suflower",
313
+ "Egg plant",
314
+ "sweet corn",
315
+ "cow pea",
316
+ "Cucumber tomato",
317
+ "Butternut",
318
+ "pumpkin",
319
+ "Lettuce",
320
+ "Malia volkensii",
321
+ "Oxytenanthera abyssinica",
322
+ "broccoli",
323
+ "chickpeas",
324
+ "Garden peas",
325
+ "Sukuma wiki",
326
+ "leafy vegetables",
327
+ "Chick peas",
328
+ "pepino melons",
329
+ "Watermelon",
330
+ "pixie plants",
331
+ "Lucerne",
332
+ "spices",
333
+ "desmodium",
334
+ "dolichos",
335
+ "pasture grass",
336
+ "kale and maize",
337
+ "mint",
338
+ "Ammi flower",
339
+ "dhania",
340
+ "Mangoes",
341
+ "cucumber capsicum",
342
+ "zucchini",
343
+ "cauliflower",
344
+ "flowering stage",
345
+ "Cabbages",
346
+ "Tomatoes & Kale",
347
+ "Tomatoes & Water melon",
348
+ "pawpaws",
349
+ "traditional vegetables",
350
+ "Green peas",
351
+ "thyme",
352
+ "chia",
353
+ "Orchard",
354
+ "cash crops",
355
+ "green peas",
356
+ "arabicum",
357
+ "arrowroot",
358
+ "Arrowroot",
359
+ "Tarragon",
360
+ "miraa",
361
+ "Bananas",
362
+ "Water melon",
363
+ "Water melon & Tomatoes",
364
+ "Oranges",
365
+ "Kales & spinach",
366
+ "beans/cowpea",
367
+ "soya bens",
368
+ "Black seed",
369
+ "flax",
370
+ "spider plant",
371
+ "jew's mallow",
372
+ "Traditional vegetables",
373
+ "Capsicum & Cabbages",
374
+ "Khat",
375
+ "amaranth",
376
+ "pak choi",
377
+ "green pea",
378
+ "Leafy vegetables",
379
+ "Pumpkin",
380
+ "Blue gam tree",
381
+ "Dolichos",
382
+ "asparagas",
383
+ "squash",
384
+ "african traditional vegetables",
385
+ "sugar snap",
386
+ "Thorn melon",
387
+ "vanilla",
388
+ "brassica",
389
+ "Rhodes grass",
390
+ "carrots",
391
+ "Pepper",
392
+ "Olive tree",
393
+ "giant nightshade",
394
+ "Zucchini",
395
+ "bamboo",
396
+ "kunde",
397
+ "blueberry",
398
+ "tamarillo",
399
+ "Kales",
400
+ "Celery",
401
+ "fruits",
402
+ "Amaranth",
403
+ "Indigenous vegetables",
404
+ "Apple trees",
405
+ "vegetables & fruit trees",
406
+ "Dhania (coriander) & beans",
407
+ "Chives",
408
+ "Blueberry",
409
+ "root crops",
410
+ "turnip",
411
+ "green vegetables",
412
+ "Arrow roots",
413
+ "Tomatoes & Sukuma wiki",
414
+ "peanut",
415
+ "oats",
416
+ "Moringa oleifera tree",
417
+ "sugarcane",
418
+ "Plantain",
419
+ "citrus trees",
420
+ "Bean",
421
+ "nappiergrass",
422
+ "Pineapple",
423
+ "cashew nuts",
424
+ "Coconuts",
425
+ "Cashews",
426
+ "pulses",
427
+ "Cashew nuts",
428
+ "Casuarina",
429
+ "Duster bean",
430
+ "giant reed",
431
+ "Groundnuts",
432
+ "coconuts",
433
+ "cashews",
434
+ "Sisal",
435
+ "eggplant",
436
+ "Sweetpotato",
437
+ "casuarina tree",
438
+ "Pineapples",
439
+ "Green house farming",
440
+ "coconut",
441
+ "Vanilla",
442
+ "cashew tree",
443
+ "Coconut",
444
+ "Cashew",
445
+ "Okra",
446
+ "agave",
447
+ "Sesame",
448
+ "black seeds",
449
+ "mchicha",
450
+ "mnavu",
451
+ "bixa",
452
+ "black nightshade",
453
+ "Melia volkensii (Mukau) tree",
454
+ "Cashew tree",
455
+ "Moringa oleifera",
456
+ "Almond tree",
457
+ "bamboo tree",
458
+ "eucalyptus",
459
+ "orange tree",
460
+ "Tree crops",
461
+ "Horticultral crops &cereals",
462
+ "Horticultral crops",
463
+ "Treecrops",
464
+ "moringa",
465
+ "dragon fruit",
466
+ "walnut tree",
467
+ "cocoa",
468
+ "Baby corn & Passion",
469
+ "asian vegetables",
470
+ "Maize and Vegetables",
471
+ "beans& Bananas",
472
+ "beans & Bananas",
473
+ "beans&S. Potatoes",
474
+ "beans& bananas",
475
+ "Maize and beans",
476
+ "Passion & bananas",
477
+ "tomatoes & S. Potatoes",
478
+ "beans & S. Potatoes",
479
+ "Solanums",
480
+ "alliums",
481
+ "Capsicum and Spinach",
482
+ "Pumpkins",
483
+ "Brachiaria",
484
+ "calliandra",
485
+ "Vegetable",
486
+ "Pepino melons",
487
+ "Arabicum",
488
+ "Tomato and French beans",
489
+ "Banana tree",
490
+ "date palm",
491
+ "Terere",
492
+ "Lemon grass",
493
+ "Brachiaria grass",
494
+ "Pixie oranges",
495
+ "Apple",
496
+ "prune tree",
497
+ "Eucalyptus tree",
498
+ "Bell pepper and Cucabits",
499
+ "Acacia trees",
500
+ "African leafy vegetables",
501
+ "hibiscus",
502
+ "pigeonpeas",
503
+ "melon",
504
+ "Capsicum & Mangoes",
505
+ "Passiuon fruits",
506
+ "Tomato and cabbage",
507
+ "watermelon",
508
+ "Sorghurm",
509
+ "greengrams/cowpeas",
510
+ "pigeonpea",
511
+ "Castor",
512
+ "nuts",
513
+ "arrow root",
514
+ "Capsicum & Pawpaw",
515
+ "Coriander",
516
+ "boma rhodes",
517
+ "Maize & Legumes",
518
+ "egg plant",
519
+ "General",
520
+ "chilies",
521
+ "Jojoba",
522
+ "Bixa orellana",
523
+ "Pulses",
524
+ "turmeric",
525
+ "Breadfruit",
526
+ "collard",
527
+ "tomatoes",
528
+ "collards",
529
+ "sweet pepper",
530
+ "cashew",
531
+ "agroforestry",
532
+ "Hay",
533
+ "Oil palm tree",
534
+ "brinjal",
535
+ "thorn melons",
536
+ "purple vetch",
537
+ "oat",
538
+ "barley",
539
+ "pea",
540
+ "Snow peas",
541
+ "dolicos",
542
+ "Cabbages & Onion",
543
+ "hot pepper",
544
+ "roselle",
545
+ "yam",
546
+ "Cucurbits",
547
+ "Baby corn",
548
+ "Hemp",
549
+ "kenaf",
550
+ "Brassicas & Cucurbits",
551
+ "horticulture",
552
+ "asparagus",
553
+ "Tuberose",
554
+ "mobydick",
555
+ "Horticultural crops.",
556
+ "potatoes",
557
+ "pyrethrum",
558
+ "Wheat/maize",
559
+ "buckwheat",
560
+ "Geranium",
561
+ "chamomile",
562
+ "Wheat and Avocado",
563
+ "blue gum",
564
+ "Mixed farming",
565
+ "Red cabbage & Courgettes",
566
+ "Sukumawiki & Capsicum",
567
+ "Moby Dick",
568
+ "Maize & Rhodes Grass",
569
+ "Leeks",
570
+ "Cantaloupe",
571
+ "butter nut",
572
+ "cabbages",
573
+ "karela",
574
+ "Lawn grass",
575
+ "Chilies",
576
+ "aloe vera",
577
+ "soya bean",
578
+ "cowpeas",
579
+ "leek",
580
+ "Eggplant",
581
+ "Bracharia",
582
+ "Pawpaws",
583
+ "bananas",
584
+ "Sukuma",
585
+ "Herbs & spices",
586
+ "Moringa",
587
+ "Regumes",
588
+ "Cow pea",
589
+ "Rosemary",
590
+ "Yellow passion fruit",
591
+ "Maize & pineapples",
592
+ "Tomato and Capsicum",
593
+ "Artichoke",
594
+ "moringa tree",
595
+ "Hot pepper",
596
+ "Pigeon peas",
597
+ "avocadoo",
598
+ "Aocados and onions",
599
+ "Potatoes",
600
+ "Biringanya",
601
+ "pilipilihoho",
602
+ "green maize",
603
+ "lentils",
604
+ "camelina",
605
+ "crambe",
606
+ "chinese cabbage",
607
+ "boma rhodes grass",
608
+ "plums",
609
+ "corn",
610
+ "shrubs",
611
+ "Onions & Tomatoes",
612
+ "Asparagus",
613
+ "dudhi",
614
+ "Brinjals",
615
+ "beans & onion",
616
+ "Orange tree",
617
+ "mulberry tree",
618
+ "rye",
619
+ "Cactus",
620
+ "Sweet wormwood",
621
+ "sunflowers",
622
+ "Cenchrus ciliaris grass",
623
+ "taff",
624
+ "Capsicum & Passion fruit",
625
+ "Gladiolus",
626
+ "Lettuce and Amaranth",
627
+ "Beabs and Amaranth",
628
+ "Sugar snaps",
629
+ "stevia",
630
+ "Bananas & Tomatoes",
631
+ "Irish potato",
632
+ "fodder crops",
633
+ "paw paw",
634
+ "Tomatoe",
635
+ "Quinoa",
636
+ "Horticulture",
637
+ "strawberries",
638
+ "Potato & Tree tomato",
639
+ "Pyrethrum",
640
+ "Squash",
641
+ "brachiaria grass",
642
+ "lemongrass",
643
+ "Nappier grass",
644
+ "passion frits",
645
+ "African bird eye chilli",
646
+ "Tobacco nursery",
647
+ "tomatoo",
648
+ "floriculture",
649
+ "hedge",
650
+ "capsicum and peas",
651
+ "cyprus trees and water melon",
652
+ "Tomato and Maize",
653
+ "Tamarillo",
654
+ "grape",
655
+ "capsicums",
656
+ "Yams",
657
+ "tree tomatoes",
658
+ "pepino melon",
659
+ "Pepino melon",
660
+ "Green pea",
661
+ "papaya",
662
+ "thorn melon",
663
+ "berries",
664
+ "Fodder crops",
665
+ "Courgettes & Capsicum",
666
+ "Duckweed",
667
+ "Capsicum and Cucumber",
668
+ "Brussel sprouts",
669
+ "Tomatoes & Capsicum",
670
+ "Capsicum & French beans",
671
+ "Capsicum and melons",
672
+ "Lawn",
673
+ "kales",
674
+ "cilantro",
675
+ "radish",
676
+ "Brachiaria Marandu",
677
+ "lawn grass",
678
+ "Strawberries",
679
+ "Custard apple",
680
+ "sagaa",
681
+ "plantain",
682
+ "Oregano",
683
+ "Apple tree",
684
+ "greeen beans",
685
+ "green beans",
686
+ "Barley",
687
+ "Blue gum trees",
688
+ "beens",
689
+ "cucumber and tomato",
690
+ "grains",
691
+ "capsicum and spinach",
692
+ "beet root",
693
+ "turia",
694
+ "tomato tree",
695
+ "carnation",
696
+ "Vetch",
697
+ "sesbania",
698
+ "Chillis",
699
+ "Black beans",
700
+ "ammi flowers",
701
+ "Oats",
702
+ "friut trees",
703
+ "sweet lupins",
704
+ "spring onion",
705
+ "Black nightshade",
706
+ "Russian comfrey",
707
+ "lucern",
708
+ "lemon",
709
+ "tephrosia",
710
+ "Oat",
711
+ "vetch",
712
+ "Avocado trees",
713
+ "safflower",
714
+ "Thyme",
715
+ "mangetout",
716
+ "snap peas",
717
+ "Chickpea",
718
+ "Black bean",
719
+ "bupleurum",
720
+ "raspberry",
721
+ "cherry berry",
722
+ "Patchouli",
723
+ "yams",
724
+ "Forest trees",
725
+ "Animal fodder",
726
+ "Capsicums",
727
+ "sugar snap peas",
728
+ "cahilli",
729
+ "Onioins",
730
+ "Irish Potato",
731
+ "Sugar snap",
732
+ "butter beans",
733
+ "sugarbeet",
734
+ "pear tree",
735
+ "snao peas",
736
+ "Strawberry and tomato",
737
+ "Maize and Potatoes",
738
+ "maize & onion",
739
+ "Apple fruits",
740
+ "Maize/Baby corn",
741
+ "Nappier",
742
+ "Tomato tree",
743
+ "kale spinach",
744
+ "capsicum & beetroot",
745
+ "Solanum",
746
+ "snow pea",
747
+ "sugar snap pea",
748
+ "Chia",
749
+ "Arrow root",
750
+ "courgette",
751
+ "Dragon fruits",
752
+ "Fresh beans",
753
+ "fresh beans",
754
+ "Chamomile",
755
+ "peppermint",
756
+ "tea tree",
757
+ "pixie oranges",
758
+ "Aloes",
759
+ "Oil palm",
760
+ "chili",
761
+ "osuga",
762
+ "African traditional vegetables",
763
+ "Avocado (Hass & Fuerte) Tomatoes",
764
+ "avocado & vegetables",
765
+ "soko",
766
+ "Watermelon and Beans",
767
+ "oil palm tree",
768
+ "artichoke",
769
+ "lawn",
770
+ "cypress tree",
771
+ "Sorghum & Green grams",
772
+ "Soya beans and Maize",
773
+ "Various",
774
+ "maize and vegetables",
775
+ "Maize & Beans",
776
+ "Cabbage & Sukuma",
777
+ "Eryngium",
778
+ "Green corn",
779
+ "Mize",
780
+ "nightshade",
781
+ "Maize & beans",
782
+ "Capsicum & Melon",
783
+ "Cinnamon",
784
+ "Parsley",
785
+ "Night shade",
786
+ "Asian vegetables",
787
+ "Tomatoes and capsicum",
788
+ "beans& Pawpaw",
789
+ "guava",
790
+ "acacia",
791
+ "batata",
792
+ "quinoa",
793
+ "broad beans",
794
+ "Miraa",
795
+ "fine beans",
796
+ "xxxx",
797
+ "xxxxxxxx",
798
+ "bambara nut",
799
+ "bambara groundnut",
800
+ "Mung beans",
801
+ "Lemongrass"
802
+ ],
803
+ "crop_counts": {
804
+ "Maize": 21202,
805
+ "beans": 11063,
806
+ "tomato": 3293,
807
+ "Tomato": 3243,
808
+ "onion": 2891,
809
+ "potato": 2349,
810
+ "maize": 2123,
811
+ "vegetables": 2049,
812
+ "Sorghum": 1416,
813
+ "capsicum": 1371,
814
+ "Capsicum": 1298,
815
+ "Rice": 1262,
816
+ "Fruit trees": 1259,
817
+ "melons": 1249,
818
+ "Potato": 1094,
819
+ "cabbage": 1051,
820
+ "banana": 999,
821
+ "Avocado": 989,
822
+ "millet": 973,
823
+ "Legumes": 969,
824
+ "fruit trees": 937,
825
+ "kale": 923,
826
+ "green gram": 907,
827
+ "sorghum": 899,
828
+ "Melons": 891,
829
+ "Coffee": 809,
830
+ "Onion": 781,
831
+ "cow peas": 761,
832
+ "cassava": 671,
833
+ "legumes": 669,
834
+ "Horticultural": 637,
835
+ "french beans": 632,
836
+ "cucumber": 623,
837
+ "French beans": 618,
838
+ "Vegetables": 603,
839
+ "wheat": 593,
840
+ "Grass": 590,
841
+ "cowpea": 564,
842
+ "Cabbage": 554,
843
+ "cucurbits": 550,
844
+ "Banana": 525,
845
+ "mango": 504,
846
+ "spinach": 498,
847
+ "sunflower": 492,
848
+ "avocado": 458,
849
+ "Sugar cane": 413,
850
+ "green grams": 400,
851
+ "Mango": 368,
852
+ "Beans": 356,
853
+ "soya bean": 355,
854
+ "Chillies": 351,
855
+ "sweet potato": 340,
856
+ "Green gram": 337,
857
+ "passion fruits": 331,
858
+ "Wheat": 330,
859
+ "cereals": 320,
860
+ "Soya beans": 316,
861
+ "Macadamia": 308,
862
+ "horticultural crops": 307,
863
+ "peas": 307,
864
+ "Kale": 296,
865
+ "Pasture": 293,
866
+ "Oil palm tree": 270,
867
+ "coffee": 262,
868
+ "pigeon peas": 261,
869
+ "groundnuts": 258,
870
+ "grass": 257,
871
+ "garlic": 250,
872
+ "Horticultural crops": 248,
873
+ "Tea": 247,
874
+ "horticultural": 226,
875
+ "strawberry": 223,
876
+ "chilli": 221,
877
+ "Trees": 217,
878
+ "pawpaw": 217,
879
+ "Passion fruits": 215,
880
+ "flowers": 211,
881
+ "carrot": 209,
882
+ "pigeon pea": 205,
883
+ "Chilli": 203,
884
+ "Tomatoes": 195,
885
+ "macadamia": 172,
886
+ "Sunflower": 158,
887
+ "Strawberry": 158,
888
+ "Sweet potato": 148,
889
+ "trees": 145,
890
+ "napier grass": 144,
891
+ "tree tomato": 144,
892
+ "groundnut": 143,
893
+ "ginger": 141,
894
+ "Cereals": 140,
895
+ "Garlic": 140,
896
+ "soya beans": 130,
897
+ "Flowers": 128,
898
+ "rice": 124,
899
+ "Jatropha": 123,
900
+ "dolichos": 122,
901
+ "courgettes": 121,
902
+ "pasture grass": 121,
903
+ "Tree tomato": 121,
904
+ "herbs": 118,
905
+ "okra": 117,
906
+ "Cotton": 114,
907
+ "snow peas": 112,
908
+ "citrus": 108,
909
+ "Brachiaria grass": 108,
910
+ "Pawpaw": 105,
911
+ "Brinjals": 105,
912
+ "sukuma wiki": 104,
913
+ "Finger millet": 104,
914
+ "Cassava": 101,
915
+ "fodder": 100,
916
+ "finger millet": 97,
917
+ "Citrus": 97,
918
+ "Various": 96,
919
+ "cotton": 95,
920
+ "Amaranthus": 94,
921
+ "Bananas": 93,
922
+ "Citrus trees": 91,
923
+ "garden peas": 91,
924
+ "butternut": 90,
925
+ "Tobacco": 87,
926
+ "lucerne": 87,
927
+ "Mulberry tree": 86,
928
+ "sugar cane": 85,
929
+ "Millet": 85,
930
+ "soybean": 85,
931
+ "Napier grass": 84,
932
+ "Spinach": 84,
933
+ "soya": 83,
934
+ "Carrot": 83,
935
+ "pineapple": 82,
936
+ "Pineapple": 82,
937
+ "baby corn": 80,
938
+ "Cenchrus ciliaris grass": 80,
939
+ "coriander": 80,
940
+ "grams": 76,
941
+ "broccoli": 75,
942
+ "simsim": 69,
943
+ "Groundnut": 68,
944
+ "Cucumber": 67,
945
+ "passion": 63,
946
+ "beans & fodder": 62,
947
+ "Sorghum & Green grams": 62,
948
+ "Maize & sunflower": 62,
949
+ "Maize & Sunflower": 62,
950
+ "oats": 60,
951
+ "pumpkin": 60,
952
+ "Herbs": 59,
953
+ "Fodder crops": 58,
954
+ "leafy vegetables": 58,
955
+ "Pyrethrum": 56,
956
+ "moringa": 55,
957
+ "pasture": 54,
958
+ "Lucerne": 51,
959
+ "arrow root": 51,
960
+ "Sweetpotato": 50,
961
+ "grapes": 48,
962
+ "Fodder": 48,
963
+ "Snow peas": 47,
964
+ "barley": 46,
965
+ "tea": 46,
966
+ "Eucalyptus": 45,
967
+ "pepper": 41,
968
+ "hay": 41,
969
+ "Green grams": 40,
970
+ "lettuce": 40,
971
+ "Cowpea": 39,
972
+ "sesame": 39,
973
+ "Pepino melon": 38,
974
+ "Sesame": 38,
975
+ "Arabicum": 38,
976
+ "managu": 38,
977
+ "brinjals": 37,
978
+ "rhodes grass": 37,
979
+ "beans/cowpea": 37,
980
+ "brassicas": 37,
981
+ "passion fruit": 36,
982
+ "Lettuce": 36,
983
+ "Grapes": 35,
984
+ "cash crops": 35,
985
+ "pulses": 35,
986
+ "orange": 34,
987
+ "Cow peas": 34,
988
+ "dragon fruit": 33,
989
+ "Mobydick": 33,
990
+ "Potatoes": 33,
991
+ "sweet corn": 32,
992
+ "dolicos": 32,
993
+ "amaranthus": 32,
994
+ "pixie": 31,
995
+ "Passion fruit": 31,
996
+ "beetroot": 30,
997
+ "Agroforestry": 29,
998
+ "collard": 29,
999
+ "Broccoli": 29,
1000
+ "pomegranate": 29,
1001
+ "Sugar snap": 29,
1002
+ "cowpeas": 29,
1003
+ "arrow roots": 28,
1004
+ "Butternut": 28,
1005
+ "Apple": 28,
1006
+ "apple": 27,
1007
+ "spices": 27,
1008
+ "pyrethrum": 27,
1009
+ "coconut": 27,
1010
+ "desmodium": 27,
1011
+ "green peas": 27,
1012
+ "cow pea": 27,
1013
+ "karella": 26,
1014
+ "Canola": 25,
1015
+ "shrubs": 24,
1016
+ "night shade": 24,
1017
+ "Peas": 24,
1018
+ "Soybean": 23,
1019
+ "Gooseberry": 23,
1020
+ "green maize": 22,
1021
+ "tobacco": 22,
1022
+ "oranges": 22,
1023
+ "Amaranth": 22,
1024
+ "Basil": 21,
1025
+ "Sukuma wiki": 21,
1026
+ "date palm": 21,
1027
+ "Fruit Trees": 20,
1028
+ "Roses": 20,
1029
+ "Khat": 20,
1030
+ "Pumpkin": 20,
1031
+ "cashew tree": 20,
1032
+ "castor": 20,
1033
+ "Soya beans and Maize": 20,
1034
+ "Bamboo": 20,
1035
+ "Mulberry": 20,
1036
+ "Geranium": 19,
1037
+ "greengrams/cowpeas": 19,
1038
+ "Sorghurm": 19,
1039
+ "Dragon fruit": 19,
1040
+ "melon": 19,
1041
+ "Rhodes grass": 19,
1042
+ "pigeonpea": 19,
1043
+ "rosemary": 18,
1044
+ "traditional vegetables": 18,
1045
+ "black seeds": 18,
1046
+ "canola": 18,
1047
+ "Berries": 17,
1048
+ "basil": 17,
1049
+ "cauliflower": 17,
1050
+ "garden pea": 17,
1051
+ "Oranges": 17,
1052
+ "agroforestry": 17,
1053
+ "forage": 17,
1054
+ "quinoa": 16,
1055
+ "leeks": 16,
1056
+ "cashew nuts": 16,
1057
+ "amaranth": 16,
1058
+ "tubers": 16,
1059
+ "Barley": 16,
1060
+ "sugarbeet": 16,
1061
+ "berries": 16,
1062
+ "Pepper": 15,
1063
+ "Squash": 15,
1064
+ "tomatoes": 15,
1065
+ "fruits": 15,
1066
+ "Courgettes": 15,
1067
+ "african traditional vegetables": 14,
1068
+ "Lemongrass": 14,
1069
+ "Water melon": 14,
1070
+ "lavender": 14,
1071
+ "Managu": 14,
1072
+ "Passion": 13,
1073
+ "Lawn grass": 13,
1074
+ "sugar snap peas": 13,
1075
+ "Brassicas": 13,
1076
+ "Okra": 13,
1077
+ "Arrow roots": 13,
1078
+ "onions": 12,
1079
+ "Sisal": 12,
1080
+ "Ginger": 12,
1081
+ "Onions": 12,
1082
+ "black nightshade": 12,
1083
+ "egg plant": 12,
1084
+ "bamboo": 12,
1085
+ "miraa": 11,
1086
+ "Oil palm": 11,
1087
+ "Rosemary": 11,
1088
+ "pepino melons": 11,
1089
+ "squash": 11,
1090
+ "eggplant": 11,
1091
+ "Garden pea": 11,
1092
+ "Hay": 11,
1093
+ "indigenous vegetables": 11,
1094
+ "Horticulture": 10,
1095
+ "Cactus": 10,
1096
+ "oat": 10,
1097
+ "chives": 10,
1098
+ "Watermelon": 10,
1099
+ "Mung beans": 9,
1100
+ "Pigeon peas": 9,
1101
+ "Oats": 9,
1102
+ "beens": 9,
1103
+ "sweet pepper": 9,
1104
+ "Moringa tree": 9,
1105
+ "Aloe vera": 9,
1106
+ "celery": 9,
1107
+ "Cashew tree": 9,
1108
+ "Pomegranate": 9,
1109
+ "khat": 9,
1110
+ "turmeric": 9,
1111
+ "Cabbages": 9,
1112
+ "Cabbages & Onion": 8,
1113
+ "mobydick": 8,
1114
+ "Traditional vegetables": 8,
1115
+ "Apples": 8,
1116
+ "": 8,
1117
+ "Night shade": 8,
1118
+ "chickpea": 8,
1119
+ "Castor": 8,
1120
+ "Sugar snaps": 8,
1121
+ "Avocados": 8,
1122
+ "Capsicums": 7,
1123
+ "root crops": 7,
1124
+ "sugar snaps": 7,
1125
+ "Garden peas": 7,
1126
+ "arrowroot": 7,
1127
+ "Stevia": 7,
1128
+ "horticulture": 7,
1129
+ "asparagus": 7,
1130
+ "vanilla": 7,
1131
+ "Maize & Legumes": 7,
1132
+ "African leafy vegetables": 7,
1133
+ "Arabicum flowers": 7,
1134
+ "chillies": 6,
1135
+ "mucuna": 6,
1136
+ "camelina": 6,
1137
+ "Green peas": 6,
1138
+ "black night shade": 6,
1139
+ "groudnuts": 6,
1140
+ "Eucalyptus tree": 6,
1141
+ "brassica": 6,
1142
+ "kunde": 6,
1143
+ "Lemon": 6,
1144
+ "crambe": 6,
1145
+ "Coriander": 6,
1146
+ "Jojoba": 6,
1147
+ "citrus trees": 6,
1148
+ "Leafy vegetables": 6,
1149
+ "Beetroot": 6,
1150
+ "Mint": 6,
1151
+ "zucchini": 6,
1152
+ "Mangoes": 6,
1153
+ "Ammi flower": 6,
1154
+ "bambara nut": 6,
1155
+ "Orchard": 5,
1156
+ "Arrowroot": 5,
1157
+ "Kales": 5,
1158
+ "Oat": 5,
1159
+ "Simsim": 5,
1160
+ "Miraa": 5,
1161
+ "lawn grass": 5,
1162
+ "bougainvillea": 5,
1163
+ "jatropha": 5,
1164
+ "agave": 5,
1165
+ "Tamarillo": 5,
1166
+ "capsicums": 5,
1167
+ "arborea trees": 5,
1168
+ "Pixie": 5,
1169
+ "turnip": 5,
1170
+ "Indigenous vegetables": 5,
1171
+ "Egg plant": 5,
1172
+ "Beans & Kales": 5,
1173
+ "cocoa": 5,
1174
+ "walnut tree": 5,
1175
+ "Moringa oleifera": 5,
1176
+ "Vanilla": 5,
1177
+ "Orange trees": 5,
1178
+ "collards": 5,
1179
+ "roselle": 5,
1180
+ "Sugar beet": 5,
1181
+ "leek": 5,
1182
+ "acacia": 5,
1183
+ "thyme": 5,
1184
+ "blue gum": 5,
1185
+ "Plantain": 4,
1186
+ "Coconuts": 4,
1187
+ "Cashews": 4,
1188
+ "oil palm tree": 4,
1189
+ "mint": 4,
1190
+ "beet root": 4,
1191
+ "Tomato and French beans": 4,
1192
+ "Butter nut": 4,
1193
+ "asian vegetables": 4,
1194
+ "Horticultral crops": 4,
1195
+ "Dolichos": 4,
1196
+ "peanut": 4,
1197
+ "capsicum and onion": 4,
1198
+ "pepino melon": 4,
1199
+ "Groundnuts": 4,
1200
+ "papaya": 4,
1201
+ "Strawberries": 4,
1202
+ "xxxx": 4,
1203
+ "cabbages": 4,
1204
+ "Chilies": 4,
1205
+ "Orange": 4,
1206
+ "spider weed": 4,
1207
+ "boma rhodes grass": 4,
1208
+ "Tomato and cabbage": 4,
1209
+ "Coconut": 4,
1210
+ "Green house farming": 4,
1211
+ "hibiscus": 4,
1212
+ "pigeonpeas": 4,
1213
+ "Pineapples": 4,
1214
+ "Maize and beans": 4,
1215
+ "Treecrops": 4,
1216
+ "Eucalyptus trees": 4,
1217
+ "Moringa": 4,
1218
+ "Regumes": 4,
1219
+ "Passiuon fruits": 4,
1220
+ "General": 4,
1221
+ "blueberry": 4,
1222
+ "Bixa orellana": 4,
1223
+ "Mize": 4,
1224
+ "beans& Pawpaw": 4,
1225
+ "Chia": 4,
1226
+ "chickpeas": 4,
1227
+ "ravaya": 4,
1228
+ "xxxxxxxx": 4,
1229
+ "Chives": 3,
1230
+ "tomatoes and cowpeas": 3,
1231
+ "kei apple": 3,
1232
+ "Brachiaria Marandu": 3,
1233
+ "radish": 3,
1234
+ "tamarillo": 3,
1235
+ "Melon": 3,
1236
+ "Hibiscus": 3,
1237
+ "Peppers": 3,
1238
+ "coconuts": 3,
1239
+ "bambara groundnut": 3,
1240
+ "Solanum": 3,
1241
+ "Baby corn": 3,
1242
+ "plums": 3,
1243
+ "solanaceae": 3,
1244
+ "thorn melons": 3,
1245
+ "hot pepper": 3,
1246
+ "Maize & pineapples": 3,
1247
+ "potatoes": 3,
1248
+ "flax": 3,
1249
+ "Tuberose": 3,
1250
+ "pawpaws": 3,
1251
+ "Eggplant": 3,
1252
+ "aloe vera": 3,
1253
+ "spider plant": 3,
1254
+ "Yellow passion fruit": 3,
1255
+ "Cow pea": 3,
1256
+ "Cherry": 3,
1257
+ "chilies": 3,
1258
+ "nuts": 3,
1259
+ "Pulses": 3,
1260
+ "stevia": 3,
1261
+ "suflower": 3,
1262
+ "Vegetable": 3,
1263
+ "Pepino melons": 3,
1264
+ "carrots": 3,
1265
+ "brachiaria grass": 3,
1266
+ "Potato & Tree tomato": 3,
1267
+ "mushrooms": 3,
1268
+ "prune tree": 3,
1269
+ "eucalyptus": 3,
1270
+ "Cauliflower": 3,
1271
+ "Tree crops": 3,
1272
+ "Horticultral crops &cereals": 3,
1273
+ "green vegetables": 3,
1274
+ "sugar snap": 3,
1275
+ "lucern": 3,
1276
+ "Pigeon pea": 3,
1277
+ "cilantro": 3,
1278
+ "Boma rhodes grass": 3,
1279
+ "Chili": 2,
1280
+ "Sweet corn": 2,
1281
+ "Blueberry": 2,
1282
+ "kales": 2,
1283
+ "broad beans": 2,
1284
+ "green pea": 2,
1285
+ "vegetables & fruit trees": 2,
1286
+ "vetch": 2,
1287
+ "Celery": 2,
1288
+ "carnation": 2,
1289
+ "sugarcane": 2,
1290
+ "Moringa oleifera tree": 2,
1291
+ "Apple tree": 2,
1292
+ "capsicum and spinach": 2,
1293
+ "cucumber and tomato": 2,
1294
+ "green beans": 2,
1295
+ "Custard apple": 2,
1296
+ "Cabbage & Sukuma": 2,
1297
+ "Arrow root": 2,
1298
+ "artichoke": 2,
1299
+ "arabicum": 2,
1300
+ "kale and maize": 2,
1301
+ "African traditional vegetables": 2,
1302
+ "Avocado (Hass & Fuerte) Tomatoes": 2,
1303
+ "soko": 2,
1304
+ "dhania": 2,
1305
+ "Melia volkensii (Mukau) tree": 2,
1306
+ "tree tomatoes": 2,
1307
+ "Cashew nuts": 2,
1308
+ "bixa tree": 2,
1309
+ "arow roots": 2,
1310
+ "Capsicum and melons": 2,
1311
+ "calliandra": 2,
1312
+ "Breadfruit": 2,
1313
+ "Acacia trees": 2,
1314
+ "Bananas & Tomatoes": 2,
1315
+ "Lemon grass": 2,
1316
+ "Terere": 2,
1317
+ "giant nightshade": 2,
1318
+ "snap peas": 2,
1319
+ "Thyme": 2,
1320
+ "safflower": 2,
1321
+ "tomatoo": 2,
1322
+ "hedge": 2,
1323
+ "Nappier grass": 2,
1324
+ "Baby corn & Passion": 2,
1325
+ "beans& Bananas": 2,
1326
+ "casuarina tree": 2,
1327
+ "Brachiaria": 2,
1328
+ "alliums": 2,
1329
+ "Quinoa": 2,
1330
+ "Tobacco nursery": 2,
1331
+ "Gladiolus": 2,
1332
+ "sunflowers": 2,
1333
+ "Pepper & Melon": 2,
1334
+ "paw paw": 2,
1335
+ "fodder crops": 2,
1336
+ "Irish potato": 2,
1337
+ "Mixed farming": 2,
1338
+ "Red cabbage & Courgettes": 2,
1339
+ "Tomatoes and Vegetables": 2,
1340
+ "kenaf": 2,
1341
+ "Cucurbits": 2,
1342
+ "Hemp": 2,
1343
+ "General crops": 2,
1344
+ "brinjal": 2,
1345
+ "corn": 2,
1346
+ "chinese cabbage": 2,
1347
+ "Asparagus": 2,
1348
+ "grevillea": 2,
1349
+ "pea": 2,
1350
+ "Wheat/maize": 2,
1351
+ "chia": 2,
1352
+ "buckwheat": 2,
1353
+ "cahilli": 2,
1354
+ "butter beans": 2,
1355
+ "pear tree": 2,
1356
+ "Strawberry and tomato": 2,
1357
+ "Tomato tree": 2,
1358
+ "maize & onion": 2,
1359
+ "Bracharia": 2,
1360
+ "Cucumber tomato": 2,
1361
+ "Oxytenanthera abyssinica": 2,
1362
+ "Malia volkensii": 2,
1363
+ "butter nut": 2,
1364
+ "karela": 2,
1365
+ "Leeks": 2,
1366
+ "Maize & Rhodes Grass": 2,
1367
+ "Moby Dick": 2,
1368
+ "maize and vegetables": 2,
1369
+ "batata": 1,
1370
+ "fine beans": 1,
1371
+ "cucumber capsicum": 1,
1372
+ "flowering stage": 1,
1373
+ "Tomatoes & Kale": 1,
1374
+ "avocado & vegetables": 1,
1375
+ "Watermelon and Beans": 1,
1376
+ "lawn": 1,
1377
+ "aubegine/ ravaya": 1,
1378
+ "K-apple": 1,
1379
+ "cypress tree": 1,
1380
+ "Maize & Beans": 1,
1381
+ "Sukumawiki & Capsicum": 1,
1382
+ "Cantaloupe": 1,
1383
+ "Pawpaws": 1,
1384
+ "bananas": 1,
1385
+ "Sukuma": 1,
1386
+ "Horticultural crops.": 1,
1387
+ "chamomile": 1,
1388
+ "water melon": 1,
1389
+ "sweet melon": 1,
1390
+ "Wheat and Avocado": 1,
1391
+ "Herbs & spices": 1,
1392
+ "Tomato and Capsicum": 1,
1393
+ "Artichoke": 1,
1394
+ "moringa tree": 1,
1395
+ "Hot pepper": 1,
1396
+ "avocadoo": 1,
1397
+ "Aocados and onions": 1,
1398
+ "Biringanya": 1,
1399
+ "pilipilihoho": 1,
1400
+ "lentils": 1,
1401
+ "yam": 1,
1402
+ "saget": 1,
1403
+ "mitoo": 1,
1404
+ "solanaceous": 1,
1405
+ "Spinach & Bulb Onions": 1,
1406
+ "Brassicas & Cucurbits": 1,
1407
+ "Capsicum and Strawberry": 1,
1408
+ "Hortcultural Crops": 1,
1409
+ "Cabbage & Onions": 1,
1410
+ "water melon & Onions": 1,
1411
+ "Gourd": 1,
1412
+ "apples": 1,
1413
+ "Capsicum & Cabbage": 1,
1414
+ "Vegetables and fruit trees": 1,
1415
+ "cashew": 1,
1416
+ "purple vetch": 1,
1417
+ "ovacadoes": 1,
1418
+ "Onions & Tomatoes": 1,
1419
+ "dudhi": 1,
1420
+ "watermelon": 1,
1421
+ "Capsicum & Pawpaw": 1,
1422
+ "boma rhodes": 1,
1423
+ "Banana tree": 1,
1424
+ "Pixie oranges": 1,
1425
+ "Bell pepper and Cucabits": 1,
1426
+ "Capsicum & Mangoes": 1,
1427
+ "beans & onion": 1,
1428
+ "Orange tree": 1,
1429
+ "mulberry tree": 1,
1430
+ "rye": 1,
1431
+ "Sweet wormwood": 1,
1432
+ "taff": 1,
1433
+ "Capsicum & Passion fruit": 1,
1434
+ "Lettuce and Amaranth": 1,
1435
+ "Beabs and Amaranth": 1,
1436
+ "Tomatoe": 1,
1437
+ "strawberries": 1,
1438
+ "lemongrass": 1,
1439
+ "passion frits": 1,
1440
+ "African bird eye chilli": 1,
1441
+ "floriculture": 1,
1442
+ "capsicum and peas": 1,
1443
+ "cyprus trees and water melon": 1,
1444
+ "beans&S. Potatoes": 1,
1445
+ "beans& bananas": 1,
1446
+ "Passion & bananas": 1,
1447
+ "tomatoes & S. Potatoes": 1,
1448
+ "beans & S. Potatoes": 1,
1449
+ "Solanums": 1,
1450
+ "Capsicum and Spinach": 1,
1451
+ "Solanaceous": 1,
1452
+ "Tomato & Capsicum": 1,
1453
+ "Pumpkins": 1,
1454
+ "Almond tree": 1,
1455
+ "bamboo tree": 1,
1456
+ "orange tree": 1,
1457
+ "Maize and Vegetables": 1,
1458
+ "beans & Bananas": 1,
1459
+ "Cashew": 1,
1460
+ "mchicha": 1,
1461
+ "wheat and onion": 1,
1462
+ "mnavu": 1,
1463
+ "bixa": 1,
1464
+ "Tomato and Maize": 1,
1465
+ "grape": 1,
1466
+ "Yams": 1,
1467
+ "Green pea": 1,
1468
+ "thorn melon": 1,
1469
+ "Casuarina": 1,
1470
+ "Duster bean": 1,
1471
+ "giant reed": 1,
1472
+ "cashews": 1,
1473
+ "Cucumber and Capsicum": 1,
1474
+ "chinese cabbage and chillies": 1,
1475
+ "Kales & bulb onions": 1,
1476
+ "Courgettes & Capsicum": 1,
1477
+ "Duckweed": 1,
1478
+ "Capsicum and Cucumber": 1,
1479
+ "Brussel sprouts": 1,
1480
+ "Tomatoes & Capsicum": 1,
1481
+ "Capsicum & French beans": 1,
1482
+ "Lawn": 1,
1483
+ "Dhania (coriander) & beans": 1,
1484
+ "Tomatoes & Sukuma wiki": 1,
1485
+ "Bean": 1,
1486
+ "nappiergrass": 1,
1487
+ "sagaa": 1,
1488
+ "plantain": 1,
1489
+ "Oregano": 1,
1490
+ "greeen beans": 1,
1491
+ "Blue gum trees": 1,
1492
+ "grains": 1,
1493
+ "turia": 1,
1494
+ "tomato tree": 1,
1495
+ "lupin beans": 1,
1496
+ "finger millet groundnut": 1,
1497
+ "black bean": 1,
1498
+ "Watermelo": 1,
1499
+ "mashrooms": 1,
1500
+ "melons passoin fruit": 1,
1501
+ "Capsicum & Spinach": 1,
1502
+ "Apple trees": 1,
1503
+ "Vetch": 1,
1504
+ "sesbania": 1,
1505
+ "Chillis": 1,
1506
+ "Black beans": 1,
1507
+ "ammi flowers": 1,
1508
+ "friut trees": 1,
1509
+ "sweet lupins": 1,
1510
+ "spring onion": 1,
1511
+ "Black nightshade": 1,
1512
+ "Russian comfrey": 1,
1513
+ "lemon": 1,
1514
+ "tephrosia": 1,
1515
+ "Avocado trees": 1,
1516
+ "pak choi": 1,
1517
+ "Blue gam tree": 1,
1518
+ "asparagas": 1,
1519
+ "Thorn melon": 1,
1520
+ "Olive tree": 1,
1521
+ "Zucchini": 1,
1522
+ "mangetout": 1,
1523
+ "Chickpea": 1,
1524
+ "Black bean": 1,
1525
+ "bupleurum": 1,
1526
+ "raspberry": 1,
1527
+ "cherry berry": 1,
1528
+ "bean": 1,
1529
+ "Patchouli": 1,
1530
+ "yams": 1,
1531
+ "Forest trees": 1,
1532
+ "Animal fodder": 1,
1533
+ "Water melon & Tomatoes": 1,
1534
+ "Kales & spinach": 1,
1535
+ "soya bens": 1,
1536
+ "Black seed": 1,
1537
+ "jew's mallow": 1,
1538
+ "Capsicum & Cabbages": 1,
1539
+ "Onioins": 1,
1540
+ "Irish Potato": 1,
1541
+ "snao peas": 1,
1542
+ "Maize and Potatoes": 1,
1543
+ "Apple fruits": 1,
1544
+ "Maize/Baby corn": 1,
1545
+ "Nappier": 1,
1546
+ "kale spinach": 1,
1547
+ "capsicum & beetroot": 1,
1548
+ "Tomatoes & Water melon": 1,
1549
+ "Chick peas": 1,
1550
+ "pixie plants": 1,
1551
+ "Tarragon": 1,
1552
+ "snow pea": 1,
1553
+ "sugar snap pea": 1,
1554
+ "courgette": 1,
1555
+ "Dragon fruits": 1,
1556
+ "Fresh beans": 1,
1557
+ "fresh beans": 1,
1558
+ "Chamomile": 1,
1559
+ "peppermint": 1,
1560
+ "tea tree": 1,
1561
+ "pixie oranges": 1,
1562
+ "Aloes": 1,
1563
+ "chili": 1,
1564
+ "osuga": 1,
1565
+ "guava": 1,
1566
+ "Eryngium": 1,
1567
+ "Green corn": 1,
1568
+ "Tomatoes and capsicum": 1,
1569
+ "nightshade": 1,
1570
+ "Maize & beans": 1,
1571
+ "Capsicum & Melon": 1,
1572
+ "Cinnamon": 1,
1573
+ "Parsley": 1,
1574
+ "Asian vegetables": 1
1575
+ }
1576
+ }
1577
+ }
1578
+ }
fertilizer_label_encoder.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8022365ff5fb35bafaebcd0440eb900c160f896c97260ed521d9ad111940fd10
3
+ size 416
fertilizer_model_info.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3b47951665725269ba846ffc43ee1caf18e5bc8ebe46360ece358cd98e20564e
3
+ size 10906
fertilizer_recommendation_model.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2db4fe1df890550e62fdf28afa820797f7d3ed9b730f79aadd2e495eb08c7f10
3
+ size 991441532
requirements.txt ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ fastapi==0.104.1
2
+ uvicorn[standard]==0.24.0
3
+ pydantic==2.5.0
4
+ scikit-learn==1.3.0
5
+ pandas==2.0.3
6
+ numpy==1.24.3
7
+ python-multipart==0.0.6