Text Classification
Transformers
Safetensors
yield-weather-soil
crop-yield
multi-temporal
regression
yield-estimation
custom_code
Instructions to use ICICLE-AI/yield-estimation with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ICICLE-AI/yield-estimation with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="ICICLE-AI/yield-estimation", trust_remote_code=True)# Load model directly from transformers import AutoModelForSequenceClassification model = AutoModelForSequenceClassification.from_pretrained("ICICLE-AI/yield-estimation", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Delete sample_test.py
Browse files- sample_test.py +0 -59
sample_test.py
DELETED
|
@@ -1,59 +0,0 @@
|
|
| 1 |
-
import json
|
| 2 |
-
|
| 3 |
-
from transformers import pipeline
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
MODEL_DIR = "."
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
with open(
|
| 10 |
-
"sample_input_weekly.json",
|
| 11 |
-
"r",
|
| 12 |
-
) as f:
|
| 13 |
-
sample = json.load(f)
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
pipe = pipeline(
|
| 17 |
-
"yield-estimation",
|
| 18 |
-
model=MODEL_DIR,
|
| 19 |
-
trust_remote_code=True,
|
| 20 |
-
)
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
print("Testing released cutoffs...\n")
|
| 24 |
-
|
| 25 |
-
for cutoff in [
|
| 26 |
-
20,
|
| 27 |
-
24,
|
| 28 |
-
28,
|
| 29 |
-
32,
|
| 30 |
-
36,
|
| 31 |
-
40,
|
| 32 |
-
44,
|
| 33 |
-
48,
|
| 34 |
-
52,
|
| 35 |
-
]:
|
| 36 |
-
x = dict(sample)
|
| 37 |
-
x["cutoff"] = cutoff
|
| 38 |
-
|
| 39 |
-
output = pipe(x)
|
| 40 |
-
|
| 41 |
-
print(
|
| 42 |
-
f"Cutoff {cutoff}: "
|
| 43 |
-
f"{output['predicted_yield']:.2f} "
|
| 44 |
-
f"{output['yield_units']}"
|
| 45 |
-
)
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
print("\nFull output at cutoff 52:")
|
| 49 |
-
|
| 50 |
-
sample["cutoff"] = 52
|
| 51 |
-
|
| 52 |
-
output = pipe(sample)
|
| 53 |
-
|
| 54 |
-
print(
|
| 55 |
-
json.dumps(
|
| 56 |
-
output,
|
| 57 |
-
indent=2,
|
| 58 |
-
)
|
| 59 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|