| !pip install gliner | |
| ### Load model directly from Hugging Face | |
| model = GLiNER.from_pretrained("selfconstruct3d/AITSecNER", load_tokenizer=True) | |
| text = """ | |
| Upon opening Emotet maldocs , victims are greeted with fake Microsoft 365 prompt that states “ THIS DOCUMENT IS PROTECTED , ” and instructs victims on how to enable macros . | |
| """ | |
| ### Labels for entity prediction | |
| #labels = ['CLICommand/CodeSnippet','CON','DATE','GROUP','LOC','MALWARE','ORG','SECTOR','TACTIC','TECHNIQUE','TOOL'] | |
| ### Perform entity prediction | |
| entities = model.predict_entities(text, labels, threshold=0.5) | |
| ### Display predicted entities and their labels | |
| for entity in entities: | |
| print(entity["text"], "=>", entity["label"]) |