File size: 605 Bytes
4439cab
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import spacy_streamlit
import typer
from torch_ner_model import build_torch_ner_model
from torch_ner_pipe import make_torch_entity_recognizer


def main(models: str = None, default_text: str = None):
    models = "training_trf/model-best"
    test = "The patient had surgery."
    models = [name.strip() for name in models.split(",")]
    labels = ["person", "problem", "pronoun", "test", "treatment"]
    spacy_streamlit.visualize(
        models, default_text, visualizers=["ner"], ner_labels=labels
    )


if __name__ == "__main__":
    try:
        typer.run(main)
    except SystemExit:
        pass