CoolFace
Apppublic

kushagrayadv/clinical-entities-relations

sourceHugging Faceupdated 2mo agoView on Hugging Face
0likes
App README

Clinical Entity + Relation Extraction

Detects clinical entities (diagnosis, medical_history, medication, procedure, symptom) and the relations between them (managed_for, complicated_by, indicates, confirms) with a fine-tuned GLiNER Relex model.

API

The Space exposes a JSON endpoint at /extract_entities_relations:

python
from gradio_client import Client

client = Client("https://<user>-<space>.hf.space")  # or Client("<user>/<space>", hf_token=...)
result = client.predict(
    "Pt with SBP and portal hypertension was given ceftriaxone.",
    0.5, 0.3,
    api_name="/extract_entities_relations",
)
# {"text", "entities": [...], "relations": [{"head", "relation", "tail", "score"}, ...]}

Configuration

Set these as Space secrets/variables (Settings → Variables and secrets):

NamePurpose
HF_TOKEN (secret)Required to download the private model repo.
GLINER_RELEX_MODELOverride the model repo id / path.
GLINER_DEVICEcpu (default) or cuda on GPU hardware.
LFM_PATCHauto (default) / always / never.