nassga commited on
Commit
6905f95
·
1 Parent(s): 5a08522

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +83 -5
app.py CHANGED
@@ -3,15 +3,93 @@ from annotated_text import annotated_text
3
  import transformers
4
 
5
  ENTITY_TO_COLOR = {
6
- 'PER': '#8ef',
7
- 'LOC': '#faa',
8
- 'ORG': '#afa',
9
- 'MISC': '#fea',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  }
11
 
12
  @st.cache_data
13
  def get_pipe():
14
- model_name = "dslim/bert-base-NER"
15
  model = transformers.AutoModelForTokenClassification.from_pretrained(model_name)
16
  tokenizer = transformers.AutoTokenizer.from_pretrained(model_name)
17
  pipe = transformers.pipeline("token-classification", model=model, tokenizer=tokenizer, aggregation_strategy="simple")
 
3
  import transformers
4
 
5
  ENTITY_TO_COLOR = {
6
+ 'B-Activity': '#8ef',
7
+ 'B-Administration': '#faa',
8
+ 'B-Age': '#afa',
9
+ 'B-Area': '#fea',
10
+ 'B-Biological_attribute': '#8ef',
11
+ 'B-Biological_structure': '#faa',
12
+ 'B-Clinical_event': '#afa',
13
+ 'B-Color': '#fea',
14
+ 'B-Coreference': '#8ef',
15
+ 'B-Date': '#faa',
16
+ 'B-Detailed_description': '#afa',
17
+ 'B-Diagnostic_procedure': '#fea',
18
+ 'B-Disease_disorder': '#8ef',
19
+ 'B-Distance': '#faa',
20
+ 'B-Dosage': '#afa',
21
+ 'B-Duration': '#fea',
22
+ 'B-Family_history': '#8ef',
23
+ 'B-Frequency': '#faa',
24
+ 'B-Height': '#afa',
25
+ 'B-History': '#fea',
26
+ 'B-Lab_value': '#8ef',
27
+ 'B-Mass': '#faa',
28
+ 'B-Medication': '#afa',
29
+ 'B-Nonbiological_location': '#fea',
30
+ 'B-Occupation': '#8ef',
31
+ 'B-Other_entity': '#faa',
32
+ 'B-Other_event': '#afa',
33
+ 'B-Outcome': '#fea',
34
+ 'B-Personal_background': '#8ef',
35
+ 'B-Qualitative_concept': '#faa',
36
+ 'B-Quantitative_concept': '#afa',
37
+ 'B-Severity': '#fea',
38
+ 'B-Sex': '#8ef',
39
+ 'B-Shape': '#faa',
40
+ 'B-Sign_symptom': '#afa',
41
+ 'B-Subject': '#fea',
42
+ 'B-Texture': '#8ef',
43
+ 'B-Therapeutic_procedure': '#faa',
44
+ 'B-Time': '#afa',
45
+ 'B-Volume': '#fea',
46
+ 'B-Weight': '#8ef',
47
+ 'I-Activity': '#faa',
48
+ 'I-Administration': '#afa',
49
+ 'I-Age': '#fea',
50
+ 'I-Area': '#8ef',
51
+ 'I-Biological_attribute': '#faa',
52
+ 'I-Biological_structure': '#afa',
53
+ 'I-Clinical_event': '#fea',
54
+ 'I-Color': '#8ef',
55
+ 'I-Coreference': '#faa',
56
+ 'I-Date': '#afa',
57
+ 'I-Detailed_description': '#fea',
58
+ 'I-Diagnostic_procedure': '#8ef',
59
+ 'I-Disease_disorder': '#faa',
60
+ 'I-Distance': '#afa',
61
+ 'I-Dosage': '#fea',
62
+ 'I-Duration': '#8ef',
63
+ 'I-Family_history': '#faa',
64
+ 'I-Frequency': '#afa',
65
+ 'I-Height': '#fea',
66
+ 'I-History': '#8ef',
67
+ 'I-Lab_value': '#faa',
68
+ 'I-Mass': '#afa',
69
+ 'I-Medication': '#fea',
70
+ 'I-Nonbiological_location': '#8ef',
71
+ 'I-Occupation': '#faa',
72
+ 'I-Other_entity': '#afa',
73
+ 'I-Other_event': '#fea',
74
+ 'I-Outcome': '#8ef',
75
+ 'I-Personal_background': '#faa',
76
+ 'I-Qualitative_concept': '#afa',
77
+ 'I-Quantitative_concept': '#fea',
78
+ 'I-Severity': '#8ef',
79
+ 'I-Shape': '#faa',
80
+ 'I-Sign_symptom': '#afa',
81
+ 'I-Subject': '#fea',
82
+ 'I-Texture': '#8ef',
83
+ 'I-Therapeutic_procedure': '#faa',
84
+ 'I-Time': '#afa',
85
+ 'I-Volume': '#fea',
86
+ 'I-Weight': '#8ef',
87
+ 'O': '#000'
88
  }
89
 
90
  @st.cache_data
91
  def get_pipe():
92
+ model_name = "nassga/nassBioMed"
93
  model = transformers.AutoModelForTokenClassification.from_pretrained(model_name)
94
  tokenizer = transformers.AutoTokenizer.from_pretrained(model_name)
95
  pipe = transformers.pipeline("token-classification", model=model, tokenizer=tokenizer, aggregation_strategy="simple")