Text Classification
Transformers
Safetensors
Spanish
bert
machine-learning
educational-example
text-embeddings-inference
Instructions to use FerData/clasificacion-texto-transformers with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use FerData/clasificacion-texto-transformers with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="FerData/clasificacion-texto-transformers")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("FerData/clasificacion-texto-transformers") model = AutoModelForSequenceClassification.from_pretrained("FerData/clasificacion-texto-transformers", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Download predict_hub.py from FerData/clasificacion-texto-transformers: direct link, hf CLI and curl.
- Browser
- Download file 839 Bytes
-
https://huggingface.co/FerData/clasificacion-texto-transformers/resolve/main/predict_hub.py
- Command line
-
hf download hf://FerData/clasificacion-texto-transformers/predict_hub.py
-
curl -L -o predict_hub.py https://huggingface.co/FerData/clasificacion-texto-transformers/resolve/main/predict_hub.py
839 Bytes
| """Descarga el modelo y el tokenizer desde Hugging Face Hub y clasifica EN ESTA PC | |
| (o en el servidor donde corra). | |
| Con Transformers alcanza con el nombre del repo: pipeline() baja config.json, | |
| model.safetensors y el tokenizer. | |
| Uso: | |
| python predict_hub.py tu-usuario/clasificador-comentarios-transformers | |
| """ | |
| import sys | |
| from transformers import pipeline | |
| REPO_ID = sys.argv[1] if len(sys.argv) > 1 else "TU-USUARIO/clasificador-comentarios-transformers" | |
| clasificador = pipeline("text-classification", model=REPO_ID) | |
| comentarios = [ | |
| "el departamento es muy luminoso", | |
| "me pareció un lugar ruidoso", | |
| "es amplio pero sobre todo tranquilo", | |
| ] | |
| for comentario, resultado in zip(comentarios, clasificador(comentarios)): | |
| print(f"{comentario!r} -> {resultado['label']} ({resultado['score']:.2f})") | |