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)# pip install -U transformers accelerate # 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
Download processing_yield.py from ICICLE-AI/yield-estimation: direct link, hf CLI and curl.
- Browser
- Download file 978 Bytes
-
https://huggingface.co/ICICLE-AI/yield-estimation/resolve/9079f0c3c728db890ea040c8a21f91bcdeaeed16/processing_yield.py
- Command line
-
hf download hf://ICICLE-AI/yield-estimation@9079f0c3c728db890ea040c8a21f91bcdeaeed16/processing_yield.py
-
curl -L -o processing_yield.py https://huggingface.co/ICICLE-AI/yield-estimation/resolve/9079f0c3c728db890ea040c8a21f91bcdeaeed16/processing_yield.py
978 Bytes
| # processing_yield.py | |
| import json | |
| from transformers.processing_utils import ProcessorMixin | |
| class YieldProcessor(ProcessorMixin): | |
| attributes = [] | |
| valid_kwargs = [] | |
| def __init__(self, **kwargs): | |
| super().__init__() | |
| def __call__(self, inputs=None, **kwargs): | |
| """ | |
| Accept either: | |
| 1. the existing dictionary input, or | |
| 2. a JSON string containing that dictionary. | |
| """ | |
| if inputs is None: | |
| inputs = kwargs | |
| if isinstance(inputs, str): | |
| try: | |
| inputs = json.loads(inputs) | |
| except json.JSONDecodeError as e: | |
| raise ValueError( | |
| "YieldProcessor expected a JSON string " | |
| "representing the model input." | |
| ) from e | |
| if not isinstance(inputs, dict): | |
| raise ValueError( | |
| "YieldProcessor expects a dictionary or JSON string." | |
| ) | |
| return inputs |