Download example.py from zeechimp/hv-core: direct link, hf CLI and curl.
- Browser
- Download file 1.32 kB
-
https://huggingface.co/zeechimp/hv-core/resolve/main/example.py
- Command line
-
hf download hf://zeechimp/hv-core/example.py
-
curl -L -o example.py https://huggingface.co/zeechimp/hv-core/resolve/main/example.py
1.32 kB
| """Minimal usage example for hv-core.""" | |
| from hv_core import HVCore | |
| TEXT = ( | |
| "The patient presented with chest pain. The ECG showed ST elevation " | |
| "in leads V2 through V5. Troponin levels were elevated at 0.8 ng/mL. " | |
| "A cardiologist was consulted within 20 minutes. The patient is " | |
| "hemodynamically stable. Therefore the patient is having an acute " | |
| "myocardial infarction. Immediate catheterization is indicated." | |
| ) | |
| def main() -> None: | |
| model = HVCore() | |
| report = model.analyze(TEXT) | |
| print("=" * 60) | |
| print("hv-core") | |
| print("=" * 60) | |
| print(model.render(report)) | |
| print() | |
| print("=" * 60) | |
| print("Numeric summary") | |
| print("=" * 60) | |
| print(f" conclusion : {report.conclusion['text']}") | |
| print(f" robustness : {report.robustness}") | |
| print(f" tier : {report.robustness_tier}") | |
| print(f" cut size : {report.cut_size}") | |
| print(f" min flip cost : {report.min_flip_cost}") | |
| print(f" redundancy : {report.redundancy_index:.3f}") | |
| print(f" load-bearing : {report.load_bearing_claim}") | |
| print() | |
| print("=" * 60) | |
| print("Flip set") | |
| print("=" * 60) | |
| for f in model.flips(TEXT, top=5): | |
| print(f" cost={f.cost:.3f} node=[{f.node_id}] {f.edit}") | |
| print() | |
| if __name__ == "__main__": | |
| main() |