Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -150,7 +150,10 @@ def run_model(input_text):
|
|
150 |
#st.text_area(visualize (runtext,output))
|
151 |
st.success(output)
|
152 |
# return output
|
153 |
-
|
|
|
|
|
|
|
154 |
|
155 |
col1, col2 = st.columns([1,1])
|
156 |
with col1:
|
@@ -158,19 +161,23 @@ with col1:
|
|
158 |
run_model(runtext)
|
159 |
sentences=runtext.split('.')
|
160 |
st.text_area('Reference text', str(reference_text), height=150)
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
|
|
|
|
|
|
|
|
167 |
|
168 |
with col2:
|
169 |
st.button('NER')
|
170 |
-
doc = nlp(str(original_text2))
|
171 |
-
colors = { "DISEASE": "pink","CHEMICAL": "orange"}
|
172 |
-
options = {"ents": [ "DISEASE", "CHEMICAL"],"colors": colors}
|
173 |
-
ent_html = displacy.render(doc, style="ent", options=options)
|
174 |
st.markdown(ent_html, unsafe_allow_html=True)
|
175 |
-
|
176 |
-
|
|
|
150 |
#st.text_area(visualize (runtext,output))
|
151 |
st.success(output)
|
152 |
# return output
|
153 |
+
doc = nlp(str(original_text2))
|
154 |
+
colors = { "DISEASE": "pink","CHEMICAL": "orange"}
|
155 |
+
options = {"ents": [ "DISEASE", "CHEMICAL"],"colors": colors}
|
156 |
+
ent_html = displacy.render(doc, style="ent", options=options)
|
157 |
|
158 |
col1, col2 = st.columns([1,1])
|
159 |
with col1:
|
|
|
161 |
run_model(runtext)
|
162 |
sentences=runtext.split('.')
|
163 |
st.text_area('Reference text', str(reference_text), height=150)
|
164 |
+
##====== Storing the Diseases/Text
|
165 |
+
table= {"Entity":[], "Class":[]}
|
166 |
+
ent_bc = {}
|
167 |
+
for x in doc.ents:
|
168 |
+
ent_bc[x.text] = x.label_
|
169 |
+
for key in ent_bc:
|
170 |
+
table["Entity"].append(key)
|
171 |
+
table["Class"].append(ent_bc[key])
|
172 |
+
trans_df = pd.DataFrame(table)
|
173 |
+
st.table(trans_df)
|
174 |
|
175 |
with col2:
|
176 |
st.button('NER')
|
177 |
+
# doc = nlp(str(original_text2))
|
178 |
+
# colors = { "DISEASE": "pink","CHEMICAL": "orange"}
|
179 |
+
# options = {"ents": [ "DISEASE", "CHEMICAL"],"colors": colors}
|
180 |
+
# ent_html = displacy.render(doc, style="ent", options=options)
|
181 |
st.markdown(ent_html, unsafe_allow_html=True)
|
182 |
+
#st.write(doc.ents)
|
183 |
+
|