Instructions to use JoltCapital/gliner_large-v2.1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- GLiNER
How to use JoltCapital/gliner_large-v2.1 with GLiNER:
from gliner import GLiNER model = GLiNER.from_pretrained("JoltCapital/gliner_large-v2.1") text = "Cristiano Ronaldo dos Santos Aveiro was born on 5 February 1985 in Funchal, Madeira, Portugal." labels = ["person", "date", "location"] entities = model.predict_entities(text, labels) for entity in entities: print(entity["text"], "=>", entity["label"]) - Notebooks
- Google Colab
- Kaggle
Download handler.py from JoltCapital/gliner_large-v2.1: direct link, hf CLI and curl.
- Browser
- Download file 468 Bytes
-
https://huggingface.co/JoltCapital/gliner_large-v2.1/resolve/main/handler.py
- Command line
-
hf download hf://JoltCapital/gliner_large-v2.1/handler.py
-
curl -L -o handler.py https://huggingface.co/JoltCapital/gliner_large-v2.1/resolve/main/handler.py
468 Bytes
| from gliner import GLiNER | |
| from typing import Dict, List, Any | |
| class EndpointHandler(): | |
| def __init__(self, path=""): | |
| self.model = GLiNER.from_pretrained("urchade/gliner_large-v2.1") | |
| def __call__(self, data: Dict[str, Any]) -> List[Dict[str, Any]]: | |
| # get inputs | |
| inputs = data.pop("inputs", data) | |
| labels = data.pop("labels", None) | |
| prediction = self.model.batch_predict_entities(inputs, labels) | |
| return prediction | |