Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,6 +7,12 @@ from transformers import pipeline
|
|
| 7 |
#def load_classifier():
|
| 8 |
#return pipeline("zero-shot-classification", model="facebook/bart-large-mnli")
|
| 9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
# Function to extract text from PDF
|
| 11 |
def extract_text_from_pdf(pdf_file):
|
| 12 |
reader = PdfReader(pdf_file)
|
|
@@ -15,11 +21,6 @@ def extract_text_from_pdf(pdf_file):
|
|
| 15 |
text += page.extract_text()
|
| 16 |
return text
|
| 17 |
|
| 18 |
-
# Streamlit app UI
|
| 19 |
-
def main():
|
| 20 |
-
st.title("PDF Genre Classifier")
|
| 21 |
-
st.write("Upload a PDF file, and this app will classify its genres using zero-shot classification.")
|
| 22 |
-
|
| 23 |
# File uploader
|
| 24 |
pdf_file = st.file_uploader("Upload PDF", type=["pdf"])
|
| 25 |
if pdf_file is not None:
|
|
|
|
| 7 |
#def load_classifier():
|
| 8 |
#return pipeline("zero-shot-classification", model="facebook/bart-large-mnli")
|
| 9 |
|
| 10 |
+
# Streamlit app UI
|
| 11 |
+
def main():
|
| 12 |
+
st.title("PDF Genre Classifier")
|
| 13 |
+
st.write("Upload a PDF file, and this app will classify its genres using zero-shot classification.")
|
| 14 |
+
|
| 15 |
+
|
| 16 |
# Function to extract text from PDF
|
| 17 |
def extract_text_from_pdf(pdf_file):
|
| 18 |
reader = PdfReader(pdf_file)
|
|
|
|
| 21 |
text += page.extract_text()
|
| 22 |
return text
|
| 23 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
# File uploader
|
| 25 |
pdf_file = st.file_uploader("Upload PDF", type=["pdf"])
|
| 26 |
if pdf_file is not None:
|