Text Classification
Scikit-learn
Portuguese
ncm
classificacao-fiscal
agronegocio
scikit-learn
skops
tfidf
Run this model with HF Jobs
Run AmandaGondra/ncm-classifier on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/AmandaGondra/ncm-classifier. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/AmandaGondra/ncm-classifier on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use AmandaGondra/ncm-classifier with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Scikit-learn
How to use AmandaGondra/ncm-classifier with Scikit-learn:
# ⚠️ Model filename not specified in config.json
- Notebooks
- Google Colab
- Kaggle
File size: 1,011 Bytes
d9d3b1c | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | """Suggest NCM positions for product descriptions with this model.
Usage (from the downloaded model folder):
pip install -r requirements.txt
python inference/predict.py "Ureia agrícola saco 50 kg" "Arame farpado 500 m"
Each description gets the three most likely positions, the calibrated
confidence of the first one, whether it should go to manual review and
whether the 31.05 small-package rule changed it.
"""
from __future__ import annotations
import json
import sys
from pathlib import Path
from ncm_classifier.inference.predictor import NcmPredictor
EXAMPLES = ["Ureia agrícola granulada, saco 50 kg", "Ureia agrícola, pacote 1 kg"]
def main() -> None:
texts = sys.argv[1:] or EXAMPLES
predictor = NcmPredictor.from_directory(Path(__file__).resolve().parents[1])
for text, prediction in zip(texts, predictor.predict(texts), strict=True):
print(json.dumps({"text": text, **prediction.to_dict()}, ensure_ascii=False, indent=2))
if __name__ == "__main__":
main()
|