from gliner2 import GLiNER2

# Load model once, use everywhere
extractor = GLiNER2.from_pretrained("Siddharth63/gliner2-small")

schema = extractor.create_schema().entities({
    "drug": "Pharmaceutical drugs, medications, or treatment names",
    "disease": "Medical conditions, illnesses, or disorders",
    "symptom": "Clinical symptoms or patient-reported symptoms",
    "drug_dosage": "Medication amounts like '50mg' or '2 tablets daily'",
    "anatomy": "Body parts or organs mentioned in medical context"
})

medical_text = """
Patient was prescribed Metformin 500 mg twice daily for Type 2 Diabetes. 
She reported fatigue and occasional dizziness. Liver function tests ordered.
"""

results = extractor.extract(medical_text, schema, 0.55)
print(results)
Downloads last month
21
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support