Download app.py from Pezh/pde: direct link, hf CLI and curl.
- Browser
- Download file 556 Bytes
-
https://huggingface.co/spaces/Pezh/pde/resolve/main/app.py
- Command line
-
hf download hf://spaces/Pezh/pde/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Pezh/pde/resolve/main/app.py
556 Bytes
| import streamlit as st | |
| import PyPDF2 | |
| def extract_text_from_pdf(uploaded_file): | |
| pdf_text = "" | |
| with open(uploaded_file.name, "rb") as file: | |
| reader = PyPDF2.PdfReader(file) | |
| for page_number in range(len(reader.pages)): | |
| pdf_text += reader.pages[page_number].extract_text() | |
| return pdf_text | |
| st.title('PDF Text Extractor') | |
| uploaded_file = st.file_uploader("Upload a PDF file", type="pdf") | |
| if uploaded_file is not None: | |
| text = extract_text_from_pdf(uploaded_file) | |
| st.write("### Extracted Text") | |
| st.write(text) |