Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -7,14 +7,6 @@ import os
|
|
7 |
model = AutoModelForSequenceClassification.from_pretrained("Reem333/Citaion-Classifier")
|
8 |
tokenizer = AutoTokenizer.from_pretrained("allenai/longformer-base-4096")
|
9 |
|
10 |
-
def extract_text_from_pdf(file_path):
|
11 |
-
text = ''
|
12 |
-
with fitz.open(file_path) as pdf_document:
|
13 |
-
for page_number in range(pdf_document.page_count):
|
14 |
-
page = pdf_document.load_page(page_number)
|
15 |
-
text += page.get_text()
|
16 |
-
return text
|
17 |
-
|
18 |
def predict_class(text):
|
19 |
try:
|
20 |
max_length = 4096
|
@@ -59,7 +51,7 @@ with st.sidebar:
|
|
59 |
st.markdown("- Level 3: More cited papers")
|
60 |
st.markdown("- Level 4: Low cited papers")
|
61 |
st.markdown("---")
|
62 |
-
st.markdown('Tabuk University')
|
63 |
|
64 |
st.title("Check Your Paper Now!")
|
65 |
|
@@ -73,12 +65,12 @@ if option == "Text":
|
|
73 |
keywords_input = st.text_area("Enter Keywords:")
|
74 |
options=["Nursing", "Physics", "Maths", "Chemical", "Nuclear", "Engineering" ,"Other"]
|
75 |
|
76 |
-
selected_category = st.selectbox("Select WoS categories:", options)
|
77 |
if selected_category == "Other":
|
78 |
custom_category = st.text_input("Enter custom category:")
|
79 |
selected_category = custom_category if custom_category else "Other"
|
80 |
|
81 |
-
combined_text = f"{title_input} [SEP] {keywords_input} [SEP] {abstract_input} [SEP] {
|
82 |
|
83 |
if st.button("Predict"):
|
84 |
if not any([title_input, abstract_input,keywords_input, full_text_input, affiliations_input]):
|
@@ -130,4 +122,4 @@ elif option == "PDF":
|
|
130 |
unsafe_allow_html=True
|
131 |
)
|
132 |
else:
|
133 |
-
st.text(label)
|
|
|
7 |
model = AutoModelForSequenceClassification.from_pretrained("Reem333/Citaion-Classifier")
|
8 |
tokenizer = AutoTokenizer.from_pretrained("allenai/longformer-base-4096")
|
9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
def predict_class(text):
|
11 |
try:
|
12 |
max_length = 4096
|
|
|
51 |
st.markdown("- Level 3: More cited papers")
|
52 |
st.markdown("- Level 4: Low cited papers")
|
53 |
st.markdown("---")
|
54 |
+
#st.markdown('Tabuk University')
|
55 |
|
56 |
st.title("Check Your Paper Now!")
|
57 |
|
|
|
65 |
keywords_input = st.text_area("Enter Keywords:")
|
66 |
options=["Nursing", "Physics", "Maths", "Chemical", "Nuclear", "Engineering" ,"Other"]
|
67 |
|
68 |
+
selected_category = st.selectbox("Select WoS categories:", options, index= None)
|
69 |
if selected_category == "Other":
|
70 |
custom_category = st.text_input("Enter custom category:")
|
71 |
selected_category = custom_category if custom_category else "Other"
|
72 |
|
73 |
+
combined_text = f"{title_input} [SEP] {keywords_input} [SEP] {abstract_input} [SEP] {selected_category} [SEP] {affiliations_input} [SEP] {' [SEP] '.join(full_text_input)}"
|
74 |
|
75 |
if st.button("Predict"):
|
76 |
if not any([title_input, abstract_input,keywords_input, full_text_input, affiliations_input]):
|
|
|
122 |
unsafe_allow_html=True
|
123 |
)
|
124 |
else:
|
125 |
+
st.text(label)
|