ajitrajasekharan
commited on
Commit
•
aed5912
1
Parent(s):
f264b44
Update app.py
Browse files
app.py
CHANGED
@@ -24,8 +24,9 @@ def decode(tokenizer, pred_idx, top_clean):
|
|
24 |
tokens = []
|
25 |
for w in pred_idx:
|
26 |
token = ''.join(tokenizer.decode(w).split())
|
27 |
-
if token not in ignore_tokens:
|
28 |
-
|
|
|
29 |
return '\n'.join(tokens[:top_clean])
|
30 |
|
31 |
def encode(tokenizer, text_sentence, add_special_tokens=True):
|
@@ -74,7 +75,7 @@ try:
|
|
74 |
|
75 |
model_name = st.sidebar.selectbox(label='Select Model to Apply', options=['ajitrajasekharan/biomedical', 'bert-base-cased','bert-large-cased','microsoft/BiomedNLP-PubMedBERT-base-uncased-abstract-fulltext','allenai/scibert_scivocab_cased'], index=0, key = "model_name")
|
76 |
bert_tokenizer, bert_model = load_bert_model(model_name)
|
77 |
-
default_text = "Imatinib is used to
|
78 |
input_text = st.text_area(
|
79 |
label="Original text",
|
80 |
value=default_text,
|
|
|
24 |
tokens = []
|
25 |
for w in pred_idx:
|
26 |
token = ''.join(tokenizer.decode(w).split())
|
27 |
+
#if token not in ignore_tokens:
|
28 |
+
# tokens.append(token.replace('##', ''))
|
29 |
+
tokens.append(token)
|
30 |
return '\n'.join(tokens[:top_clean])
|
31 |
|
32 |
def encode(tokenizer, text_sentence, add_special_tokens=True):
|
|
|
75 |
|
76 |
model_name = st.sidebar.selectbox(label='Select Model to Apply', options=['ajitrajasekharan/biomedical', 'bert-base-cased','bert-large-cased','microsoft/BiomedNLP-PubMedBERT-base-uncased-abstract-fulltext','allenai/scibert_scivocab_cased'], index=0, key = "model_name")
|
77 |
bert_tokenizer, bert_model = load_bert_model(model_name)
|
78 |
+
default_text = "Imatinib is used to [MASK] nsclc"
|
79 |
input_text = st.text_area(
|
80 |
label="Original text",
|
81 |
value=default_text,
|