Token Classification
Transformers
Safetensors
English
modernbert
fill-mask
clinical
medical
biomedical
named-entity-recognition
maccrobat
ettin
Instructions to use CobuildX-AI/cbx-clinical-entity-extractor-17M with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use CobuildX-AI/cbx-clinical-entity-extractor-17M with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("token-classification", model="CobuildX-AI/cbx-clinical-entity-extractor-17M")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForMaskedLM tokenizer = AutoTokenizer.from_pretrained("CobuildX-AI/cbx-clinical-entity-extractor-17M") model = AutoModelForMaskedLM.from_pretrained("CobuildX-AI/cbx-clinical-entity-extractor-17M", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Download example.py from CobuildX-AI/cbx-clinical-entity-extractor-17M: direct link, hf CLI and curl.
- Browser
- Download file 1.01 kB
-
https://huggingface.co/CobuildX-AI/cbx-clinical-entity-extractor-17M/resolve/main/example.py
- Command line
-
hf download hf://CobuildX-AI/cbx-clinical-entity-extractor-17M/example.py
-
curl -L -o example.py https://huggingface.co/CobuildX-AI/cbx-clinical-entity-extractor-17M/resolve/main/example.py
1.01 kB
| """Run the model on an invented case report (not from MACCROBAT or any real patient). | |
| python example.py | |
| """ | |
| from cbx_clinical import ClinicalEntityExtractor | |
| TEXT = """A 47-year-old woman presented to the emergency department with a 3-day history of fever and severe right upper quadrant pain. | |
| She had a history of type 2 diabetes mellitus treated with metformin 500 mg twice daily. | |
| Physical examination revealed tenderness in the right upper quadrant, and her temperature was 38.9 °C. | |
| Laboratory tests showed an elevated white blood cell count of 15,200/µL. | |
| Abdominal ultrasound demonstrated a distended gallbladder with a thickened wall and multiple gallstones. | |
| She was diagnosed with acute cholecystitis and started on intravenous ceftriaxone. | |
| Laparoscopic cholecystectomy was performed two days later, and she was discharged home on postoperative day 3.""" | |
| if __name__ == "__main__": | |
| ner = ClinicalEntityExtractor(".") | |
| for e in ner.extract(TEXT): | |
| print(f"{e['label']:24s} {e['text']}") | |