v0.2: 4M, made from cbx-pii-extractor-17M v0.2 (16K vocab, compressed word table, 4 layers, 68M teacher)
c57104c verified Download example.py from CobuildX-AI/cbx-pii-extractor-4M: direct link, hf CLI and curl.
- Browser
- Download file 1.13 kB
-
https://huggingface.co/CobuildX-AI/cbx-pii-extractor-4M/resolve/main/example.py
- Command line
-
hf download hf://CobuildX-AI/cbx-pii-extractor-4M/example.py
-
curl -L -o example.py https://huggingface.co/CobuildX-AI/cbx-pii-extractor-4M/resolve/main/example.py
1.13 kB
| """Check the install: find and redact PII in four sample texts. | |
| python example.py | |
| """ | |
| from pii import PIIExtractor | |
| SAMPLES = [ | |
| "Hi team, I'm Priya Raman (priya.raman@northwind.com). Please call me on +1-860-555-0185 ext 204 " | |
| "before Friday's review of ticket INC-48213.", | |
| "Shipping address for order PO-552310: Marcus Bell, 742 Evergreen Terrace, Springfield, IL 62704. " | |
| "Card ending 4417, customer no. CU-0098213, date of birth 1987-03-14. Our Denver office will follow up.", | |
| "User: my login is mbell_92 and the temporary password is K7#pQ2!xZ. The portal is " | |
| "portal.northwind.io/reset and my server IP is 10.24.8.117. Employee ID EMP-20931, SSN 512-44-9087.", | |
| "<@U02NORA> can you send dan the verification code 357-761-475? Patient MRN 00482917 is booked for Tuesday.", | |
| ] | |
| pii = PIIExtractor() | |
| print(f"model loaded on {pii.device}\n") | |
| for text in SAMPLES: | |
| spans, ms = pii.timed_extract(text) | |
| print(text) | |
| for s in spans: | |
| print(f" {s['label']:15} {s['text']!r} [{s['start']}:{s['end']}]") | |
| print(f" redacted: {pii.redact(text)}") | |
| print(f" ({ms:.0f} ms)\n") | |