Spaces:
Sleeping
Sleeping
Commit
β’
d472283
1
Parent(s):
bc866db
Update app.py
Browse files
app.py
CHANGED
@@ -40,7 +40,7 @@ def main():
|
|
40 |
|
41 |
return text.replace("REDACTED", "").lower().replace(" "," ").replace("[Name]", "").replace("[your name]", "").replace("\n your name", "").\
|
42 |
replace("dear admissions committee,", "").replace("sincerely,","").\
|
43 |
-
replace("[university's name]"
|
44 |
replace("β statement of intent ","").\
|
45 |
replace('program: master of science in data analytics name of applicant: ',"").\
|
46 |
replace("data analytics", "data science").replace("| \u200b","").\
|
@@ -79,7 +79,7 @@ def main():
|
|
79 |
|
80 |
@st.cache(allow_output_mutation=True, suppress_st_warning=True)
|
81 |
def load_tokenizer(option):
|
82 |
-
if option
|
83 |
tokenizer = AutoTokenizer.from_pretrained("bert-base-uncased", padding='max_length', max_length=512, truncation=True)
|
84 |
else:
|
85 |
tokenizer = AutoTokenizer.from_pretrained("distilbert-base-uncased", padding='max_length', max_length=512, truncation=True)
|
@@ -87,10 +87,14 @@ def main():
|
|
87 |
|
88 |
@st.cache(allow_output_mutation=True, suppress_st_warning=True)
|
89 |
def load_model(option):
|
90 |
-
if option == "BERT
|
91 |
-
model = HF_BertBasedModelAppDocs.from_pretrained("
|
|
|
|
|
|
|
|
|
92 |
else:
|
93 |
-
model = HF_DistilBertBasedModelAppDocs.from_pretrained("
|
94 |
return model
|
95 |
|
96 |
|
@@ -98,8 +102,12 @@ def main():
|
|
98 |
|
99 |
models_available = {"LR Generated":"models/baseline_model_lr_generated.joblib",
|
100 |
"NB Generated": "models/baseline_model_nb_generated.joblib",
|
101 |
-
"D-BERT Generated": "GradApplicationDocuments/
|
102 |
-
"BERT Generated": "GradApplicationDocuments/
|
|
|
|
|
|
|
|
|
103 |
}
|
104 |
|
105 |
st.set_page_config(page_title="AI/Human GradAppDocs", page_icon="π€", layout="wide")
|
|
|
40 |
|
41 |
return text.replace("REDACTED", "").lower().replace(" "," ").replace("[Name]", "").replace("[your name]", "").replace("\n your name", "").\
|
42 |
replace("dear admissions committee,", "").replace("sincerely,","").\
|
43 |
+
replace("[university's name]").replace("dear sir/madam,","").\
|
44 |
replace("β statement of intent ","").\
|
45 |
replace('program: master of science in data analytics name of applicant: ',"").\
|
46 |
replace("data analytics", "data science").replace("| \u200b","").\
|
|
|
79 |
|
80 |
@st.cache(allow_output_mutation=True, suppress_st_warning=True)
|
81 |
def load_tokenizer(option):
|
82 |
+
if option in ("BERT Generated", "BERT Revised"):
|
83 |
tokenizer = AutoTokenizer.from_pretrained("bert-base-uncased", padding='max_length', max_length=512, truncation=True)
|
84 |
else:
|
85 |
tokenizer = AutoTokenizer.from_pretrained("distilbert-base-uncased", padding='max_length', max_length=512, truncation=True)
|
|
|
87 |
|
88 |
@st.cache(allow_output_mutation=True, suppress_st_warning=True)
|
89 |
def load_model(option):
|
90 |
+
if option == "BERT Generated":
|
91 |
+
model = HF_BertBasedModelAppDocs.from_pretrained("GradApplicationDocuments/BERTGradGen").to(device)
|
92 |
+
elif option == "BERT Revised":
|
93 |
+
model = HF_BertBasedModelAppDocs.from_pretrained("GradApplicationDocuments/BERTGradRevised").to(device)
|
94 |
+
elif option == "D-BERT Generated":
|
95 |
+
model = HF_BertBasedModelAppDocs.from_pretrained("GradApplicationDocuments/DistilBERTGradGen").to(device)
|
96 |
else:
|
97 |
+
model = HF_DistilBertBasedModelAppDocs.from_pretrained("GradApplicationDocuments/DistilBERTGradRevised").to(device)
|
98 |
return model
|
99 |
|
100 |
|
|
|
102 |
|
103 |
models_available = {"LR Generated":"models/baseline_model_lr_generated.joblib",
|
104 |
"NB Generated": "models/baseline_model_nb_generated.joblib",
|
105 |
+
"D-BERT Generated": "GradApplicationDocuments/DistilBERTGradGen",
|
106 |
+
"BERT Generated": "GradApplicationDocuments/BERTGradGen",
|
107 |
+
"LR Revised":"models/baseline_model_lr_revised.joblib",
|
108 |
+
"NB Revised": "models/baseline_model_nb_revised.joblib",
|
109 |
+
"D-BERT Revised": "GradApplicationDocuments/DistilBERTGradRevised",
|
110 |
+
"BERT Revised": "GradApplicationDocuments/BERTGradRevised",
|
111 |
}
|
112 |
|
113 |
st.set_page_config(page_title="AI/Human GradAppDocs", page_icon="π€", layout="wide")
|