Update app.py
Browse files
app.py
CHANGED
|
@@ -1,8 +1,15 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
import pandas as pd
|
| 3 |
import transformers
|
|
|
|
|
|
|
|
|
|
| 4 |
from transformers import pipeline, TokenClassificationPipeline, BertForTokenClassification , AutoTokenizer , TextClassificationPipeline , AutoModelForSequenceClassification
|
| 5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
st.header("Knowledge extraction on Endocrine disruptors")
|
| 7 |
st.write("This tool lets you extract relation triples concerning interactions between: endocrine disrupting chemicals, hormones, receptors and cancers.")
|
| 8 |
st.write("It is the result of an end of studies project within ESI school and dedicated to biomedical researchers looking to extract precise information about the subject without digging into long publications.")
|
|
@@ -217,16 +224,30 @@ if submit and len(x) != 0:
|
|
| 217 |
|
| 218 |
|
| 219 |
edccan = []
|
| 220 |
-
|
| 221 |
|
| 222 |
for i in range(len(outrelbl)):
|
| 223 |
if outrelbl[i] != "other":
|
| 224 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 225 |
|
| 226 |
edccandf = pd.DataFrame(edccan, columns= ["Sentence", "Entity 1", "Entity 2", "Relation"] )
|
| 227 |
|
| 228 |
|
| 229 |
st.table(edccandf)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 230 |
|
| 231 |
|
| 232 |
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
import pandas as pd
|
| 3 |
import transformers
|
| 4 |
+
import re
|
| 5 |
+
import postt
|
| 6 |
+
from postt import postcor
|
| 7 |
from transformers import pipeline, TokenClassificationPipeline, BertForTokenClassification , AutoTokenizer , TextClassificationPipeline , AutoModelForSequenceClassification
|
| 8 |
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
|
| 13 |
st.header("Knowledge extraction on Endocrine disruptors")
|
| 14 |
st.write("This tool lets you extract relation triples concerning interactions between: endocrine disrupting chemicals, hormones, receptors and cancers.")
|
| 15 |
st.write("It is the result of an end of studies project within ESI school and dedicated to biomedical researchers looking to extract precise information about the subject without digging into long publications.")
|
|
|
|
| 224 |
|
| 225 |
|
| 226 |
edccan = []
|
| 227 |
+
edccanbis = []
|
| 228 |
|
| 229 |
for i in range(len(outrelbl)):
|
| 230 |
if outrelbl[i] != "other":
|
| 231 |
+
edccanbis += [[lstSentEnt[i][0], lstSentEnt[i][1], outrelbl[i][:-7], lstSentEnc[i], lstSentbilbl[i]]]
|
| 232 |
+
#edccan += [[lstSentEnc[i],lstSentEnt[i][0]+" ["+lstSentbilbl[i][0][2:]+"]", lstSentEnt[i][1]+" ["+lstSentbilbl[i][1][2:]+"]",outrelbl[i][:-7]]]
|
| 233 |
+
|
| 234 |
+
edccanbis = postcor(edccanbis[3:])
|
| 235 |
+
|
| 236 |
+
|
| 237 |
+
for e in edccanbis:
|
| 238 |
+
edccan += [[e[3],e[0]+" ["+e[-1][0][2:]+"]", e[1]+" ["+e[-1][1][2:]+"]",e[2][:-7]]]
|
| 239 |
|
| 240 |
edccandf = pd.DataFrame(edccan, columns= ["Sentence", "Entity 1", "Entity 2", "Relation"] )
|
| 241 |
|
| 242 |
|
| 243 |
st.table(edccandf)
|
| 244 |
+
csv = edccandf.to_csv(index=False).encode('utf-8')
|
| 245 |
+
st.download_button(
|
| 246 |
+
label="Download data as CSV",
|
| 247 |
+
data=csv,
|
| 248 |
+
file_name='Relation_triples.csv',
|
| 249 |
+
mime='text/csv',
|
| 250 |
+
)
|
| 251 |
|
| 252 |
|
| 253 |
|