Spaces:
Runtime error
Runtime error
Commit
•
cbf1a0e
1
Parent(s):
63e34fe
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import spacy_streamlit
|
2 |
+
import typer
|
3 |
+
from torch_ner_model import build_torch_ner_model
|
4 |
+
from torch_ner_pipe import make_torch_entity_recognizer
|
5 |
+
|
6 |
+
|
7 |
+
def main(models: str = None, default_text: str = None):
|
8 |
+
models = "training_trf/model-best"
|
9 |
+
test = "The patient had surgery."
|
10 |
+
models = [name.strip() for name in models.split(",")]
|
11 |
+
labels = ["person", "problem", "pronoun", "test", "treatment"]
|
12 |
+
spacy_streamlit.visualize(
|
13 |
+
models, default_text, visualizers=["ner"], ner_labels=labels
|
14 |
+
)
|
15 |
+
|
16 |
+
|
17 |
+
if __name__ == "__main__":
|
18 |
+
try:
|
19 |
+
typer.run(main)
|
20 |
+
except SystemExit:
|
21 |
+
pass
|