Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -100,6 +100,21 @@ with col4:
|
|
100 |
|
101 |
runtext =st.text_area(inputNote, str(original_text2), height=300)
|
102 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
|
104 |
def visualize (run_text,output):
|
105 |
text =''
|
@@ -170,8 +185,12 @@ with col1:
|
|
170 |
table["Entity"].append(key)
|
171 |
table["Class"].append(ent_bc[key])
|
172 |
trans_df = pd.DataFrame(table)
|
173 |
-
st.
|
174 |
-
|
|
|
|
|
|
|
|
|
175 |
with col2:
|
176 |
st.button('NER')
|
177 |
# doc = nlp(str(original_text2))
|
|
|
100 |
|
101 |
runtext =st.text_area(inputNote, str(original_text2), height=300)
|
102 |
|
103 |
+
# Extract words associated with each entity
|
104 |
+
def genEntities(ann, entity):
|
105 |
+
# entity colour dict
|
106 |
+
#ent_col = {'DISEASE':'#B42D1B', 'CHEMICAL':'#F06292'}
|
107 |
+
ent_col = {'DISEASE':'pink', 'CHEMICAL':'orange'}
|
108 |
+
# separate into the different entities
|
109 |
+
entities = trans_df['Class'].unique()
|
110 |
+
|
111 |
+
if entity in entities:
|
112 |
+
ent = list(trans_df[trans_df['Class']==entity]['Entity'].unique())
|
113 |
+
entlist = ",".join(ent)
|
114 |
+
st.markdown(f'<p style="color:{ent_col[entity]};font-size:20px;">{entlist}</p>', unsafe_allow_html=True)
|
115 |
+
#for i in ent:
|
116 |
+
#st.markdown(f'<p style="color:{ent_col[entity]};font-size:20px;">{i}</p>', unsafe_allow_html=True)
|
117 |
+
|
118 |
|
119 |
def visualize (run_text,output):
|
120 |
text =''
|
|
|
185 |
table["Entity"].append(key)
|
186 |
table["Class"].append(ent_bc[key])
|
187 |
trans_df = pd.DataFrame(table)
|
188 |
+
st.subheader("DISEASE")
|
189 |
+
genEntities(trans_df, 'DISEASE')
|
190 |
+
st.subheader("CHEMICAL")
|
191 |
+
genEntities(trans_df, 'CHEMICAL')
|
192 |
+
#st.table(trans_df)
|
193 |
+
|
194 |
with col2:
|
195 |
st.button('NER')
|
196 |
# doc = nlp(str(original_text2))
|