Views
No views yet
crop_recommendation_model.pkl - Trained classifier for crop recommendationsrf_yield_model.pkl - Random Forest model for yield predictionunified_recommendation_engine.pkl - Combined recommendation engineengine_config.pkl - Configuration for the recommendation enginecrop_feature_names.pkl - Feature names for crop recommendation modelcrop_label_encoder.pkl - Label encoder for crop classescrop_scaler.pkl - Scaler for crop recommendation featuresscaler.pkl - Scaler for yield prediction featuresyield_feature_names.pkl - Feature names for yield prediction modelengineered_features.csv - Processed agricultural featuresraw_crop_data.csv - Raw crop data for trainingpip install -r requirements.txt1from huggingface_hub import hf_hub_download
2import joblib
3
4# Download crop recommendation model
5crop_model_path = hf_hub_download(
6 repo_id="Nur2712/agricultural-advisory",
7 filename="models/crop_recommendation_model.pkl",
8 local_dir="./models"
9)
10
11# Load the model
12crop_model = joblib.load(crop_model_path)
13
14# Download scaler
15scaler_path = hf_hub_download(
16 repo_id="Nur2712/agricultural-advisory",
17 filename="utilities/crop_scaler.pkl",
18 local_dir="./models"
19)
20scaler = joblib.load(scaler_path)1import joblib
2import numpy as np
3from huggingface_hub import hf_hub_download
4
5# Download and load models
6model_path = hf_hub_download(
7 repo_id="Nur2712/agricultural-advisory",
8 filename="models/crop_recommendation_model.pkl"
9)
10model = joblib.load(model_path)
11
12scaler_path = hf_hub_download(
13 repo_id="Nur2712/agricultural-advisory",
14 filename="utilities/crop_scaler.pkl"
15)
16scaler = joblib.load(scaler_path)
17
18# Prepare features (example)
19features = np.array([[100, 25, 70, 50]]) # rainfall_mm, temp_avg, humidity_percent, area_hectares
20features_scaled = scaler.transform(features)
21
22# Make prediction
23prediction = model.predict(features_scaled)
24print(f"Recommended crop: {prediction[0]}")DEPLOYMENT.md for API endpoint documentation.1import requests
2
3# Get crop recommendations
4response = requests.get(
5 "http://localhost:8000/crops/recommendations",
6 params={
7 "rainfall_mm": 100,
8 "temp_avg": 25,
9 "humidity_percent": 70,
10 "area_hectares": 50
11 }
12)
13recommendations = response.json()
14
15# Predict yield
16response = requests.get(
17 "http://localhost:8000/yield/predict",
18 params={
19 "area_hectares": 50,
20 "rainfall_mm": 100,
21 "temp_avg": 25,
22 "humidity_percent": 70
23 }
24)
25yield_prediction = response.json()├── models/ # Trained ML models
├── utilities/ # Scalers, encoders, feature names
├── data/ # Training and processed data
└── DEPLOYMENT.md # Deployment documentation1@misc{agricultural-advisory-bangladesh,
2 title={Agricultural Advisory System for Bangladesh},
3 author={Nur2712},
4 year={2025},
5 howpublished={\url{https://huggingface.co/Nur2712/agricultural-advisory}}
6}