Update app.py
Browse files
app.py
CHANGED
|
@@ -12,17 +12,6 @@ longformer_tokenizer = AutoTokenizer.from_pretrained("allenai/longformer-base-40
|
|
| 12 |
bert_model = AutoModelForSequenceClassification.from_pretrained("Reem333/BERT")
|
| 13 |
bert_tokenizer = AutoTokenizer.from_pretrained("google-bert/bert-base-uncased")
|
| 14 |
|
| 15 |
-
# Function to extract text from PDF
|
| 16 |
-
def extract_text_from_pdf(file_path):
|
| 17 |
-
text = ''
|
| 18 |
-
try:
|
| 19 |
-
with fitz.open(file_path) as pdf_document:
|
| 20 |
-
for page_number in range(pdf_document.page_count):
|
| 21 |
-
page = pdf_document.load_page(page_number)
|
| 22 |
-
text += page.get_text()
|
| 23 |
-
except Exception as e:
|
| 24 |
-
st.error(f"Error reading PDF file: {e}")
|
| 25 |
-
return text
|
| 26 |
|
| 27 |
# Function to predict the class of the text using a specified model and tokenizer
|
| 28 |
def predict_class(text, model, tokenizer):
|
|
@@ -64,13 +53,13 @@ with st.sidebar:
|
|
| 64 |
st.markdown("## About")
|
| 65 |
st.markdown('''
|
| 66 |
This tool classifies paper citations into different levels based on their number of citations.
|
| 67 |
-
Powered by Fine-Tuned [Longformer model](https://huggingface.co/
|
| 68 |
''')
|
| 69 |
st.markdown("### Class Levels:")
|
| 70 |
-
st.markdown("- Level 1:
|
| 71 |
st.markdown("- Level 2: Average cited papers")
|
| 72 |
st.markdown("- Level 3: More cited papers")
|
| 73 |
-
st.markdown("- Level 4:
|
| 74 |
st.markdown("---")
|
| 75 |
st.markdown('Tabuk University')
|
| 76 |
|
|
|
|
| 12 |
bert_model = AutoModelForSequenceClassification.from_pretrained("Reem333/BERT")
|
| 13 |
bert_tokenizer = AutoTokenizer.from_pretrained("google-bert/bert-base-uncased")
|
| 14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
# Function to predict the class of the text using a specified model and tokenizer
|
| 17 |
def predict_class(text, model, tokenizer):
|
|
|
|
| 53 |
st.markdown("## About")
|
| 54 |
st.markdown('''
|
| 55 |
This tool classifies paper citations into different levels based on their number of citations.
|
| 56 |
+
Powered by Fine-Tuned [Longformer model](https://huggingface.co/Reem333/LongFormer) and BERT model with custom data.
|
| 57 |
''')
|
| 58 |
st.markdown("### Class Levels:")
|
| 59 |
+
st.markdown("- Level 1: Low cited papers")
|
| 60 |
st.markdown("- Level 2: Average cited papers")
|
| 61 |
st.markdown("- Level 3: More cited papers")
|
| 62 |
+
st.markdown("- Level 4: Highly cited papers")
|
| 63 |
st.markdown("---")
|
| 64 |
st.markdown('Tabuk University')
|
| 65 |
|