Update app.py
Browse files
app.py
CHANGED
|
@@ -8,11 +8,11 @@ import postt
|
|
| 8 |
from postt import postcor
|
| 9 |
from transformers import pipeline, TokenClassificationPipeline, BertForTokenClassification , AutoTokenizer , TextClassificationPipeline , AutoModelForSequenceClassification
|
| 10 |
|
|
|
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
-
|
| 15 |
-
st.header("Knowledge extraction on Endocrine disruptors")
|
| 16 |
st.write("This tool lets you extract relation triples concerning interactions between: endocrine disrupting chemicals, hormones, receptors and cancers.")
|
| 17 |
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.")
|
| 18 |
|
|
@@ -33,6 +33,7 @@ if submit and len(x) != 0:
|
|
| 33 |
|
| 34 |
tokenizer = AutoTokenizer.from_pretrained("dmis-lab/biobert-large-cased-v1.1", truncation = True, padding=True, model_max_length=512,)
|
| 35 |
model_checkpoint = BertForTokenClassification.from_pretrained("dexay/Ner2HgF", )
|
|
|
|
| 36 |
model_re = AutoModelForSequenceClassification.from_pretrained("dexay/reDs3others", )
|
| 37 |
|
| 38 |
token_classifier = pipeline("token-classification", tokenizer = tokenizer,model=model_checkpoint, )
|
|
@@ -173,9 +174,8 @@ if submit and len(x) != 0:
|
|
| 173 |
|
| 174 |
#lstSentEnc,lstSentEnt,lstSentbilbl
|
| 175 |
|
| 176 |
-
st.
|
| 177 |
-
st.
|
| 178 |
-
st.text("Next: Relation detection ...")
|
| 179 |
|
| 180 |
|
| 181 |
# Relation extraction part
|
|
@@ -311,16 +311,16 @@ if submit and len(x) != 0:
|
|
| 311 |
st.table(edccandf)
|
| 312 |
csv = edccandf.to_csv(index=False).encode('utf-8')
|
| 313 |
with st.sidebar:
|
| 314 |
-
st.
|
| 315 |
-
st.
|
| 316 |
-
st.write("Download table only:")
|
| 317 |
st.download_button(
|
| 318 |
label="Download CSV",
|
| 319 |
data=csv,
|
| 320 |
file_name='Relation_triples_table.csv',
|
| 321 |
mime='text/csv',
|
| 322 |
)
|
| 323 |
-
st.write("Download table plus separate csvs for each family of pairs:")
|
| 324 |
with open("allcsvs.zip", "rb") as fp:
|
| 325 |
btn = st.download_button(
|
| 326 |
label="Download ZIP",
|
|
|
|
| 8 |
from postt import postcor
|
| 9 |
from transformers import pipeline, TokenClassificationPipeline, BertForTokenClassification , AutoTokenizer , TextClassificationPipeline , AutoModelForSequenceClassification
|
| 10 |
|
| 11 |
+
st.set_page_config(layout="wide")
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
+
st.title("Knowledge extraction: EDCs")
|
|
|
|
| 16 |
st.write("This tool lets you extract relation triples concerning interactions between: endocrine disrupting chemicals, hormones, receptors and cancers.")
|
| 17 |
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.")
|
| 18 |
|
|
|
|
| 33 |
|
| 34 |
tokenizer = AutoTokenizer.from_pretrained("dmis-lab/biobert-large-cased-v1.1", truncation = True, padding=True, model_max_length=512,)
|
| 35 |
model_checkpoint = BertForTokenClassification.from_pretrained("dexay/Ner2HgF", )
|
| 36 |
+
st.caption("Downloading models")
|
| 37 |
model_re = AutoModelForSequenceClassification.from_pretrained("dexay/reDs3others", )
|
| 38 |
|
| 39 |
token_classifier = pipeline("token-classification", tokenizer = tokenizer,model=model_checkpoint, )
|
|
|
|
| 174 |
|
| 175 |
#lstSentEnc,lstSentEnt,lstSentbilbl
|
| 176 |
|
| 177 |
+
st.caption("Entities detected.")
|
| 178 |
+
st.caption("Next: Relation detection ...")
|
|
|
|
| 179 |
|
| 180 |
|
| 181 |
# Relation extraction part
|
|
|
|
| 311 |
st.table(edccandf)
|
| 312 |
csv = edccandf.to_csv(index=False).encode('utf-8')
|
| 313 |
with st.sidebar:
|
| 314 |
+
st.subheader("You can only choose one download !!")
|
| 315 |
+
st.caption("we recommed ZIP file.")
|
| 316 |
+
st.write("Download table only :")
|
| 317 |
st.download_button(
|
| 318 |
label="Download CSV",
|
| 319 |
data=csv,
|
| 320 |
file_name='Relation_triples_table.csv',
|
| 321 |
mime='text/csv',
|
| 322 |
)
|
| 323 |
+
st.write("Download table plus separate csvs for each family of pairs :")
|
| 324 |
with open("allcsvs.zip", "rb") as fp:
|
| 325 |
btn = st.download_button(
|
| 326 |
label="Download ZIP",
|