Views
No views yet
agriculture_model.pkl — Trained Logistic Regression modelvectorizer.pkl — Fitted TF–IDF vectorizer for text preprocessing1from huggingface_hub import hf_hub_download
2import joblib
3
4# Download files from Hugging Face Hub
5model_path = hf_hub_download("PopeJohn/agriculture-model", "agriculture_model.pkl")
6vectorizer_path = hf_hub_download("PopeJohn/agriculture-model", "vectorizer.pkl")
7
8# Load
9model = joblib.load(model_path)
10vectorizer = joblib.load(vectorizer_path)
11
12# Predict
13sample_text = ["Healthy maize crop after seasonal rains"]
14prediction = model.predict(vectorizer.transform(sample_text))
15print(prediction[0])