Spaces:
Sleeping
Sleeping
Download ingestion_engine/pdf_extractor.py from AiQademy/NotebookLM: direct link, hf CLI and curl.
- Browser
- Download file 345 Bytes
-
https://huggingface.co/spaces/AiQademy/NotebookLM/resolve/main/ingestion_engine/pdf_extractor.py
- Command line
-
hf download hf://spaces/AiQademy/NotebookLM/ingestion_engine/pdf_extractor.py
-
curl -L -o pdf_extractor.py https://huggingface.co/spaces/AiQademy/NotebookLM/resolve/main/ingestion_engine/pdf_extractor.py
345 Bytes
| """PDF text extraction using PyMuPDF.""" | |
| import fitz | |
| def extract(file_path: str) -> str: | |
| """Extract text from all pages of a PDF file.""" | |
| doc = fitz.open(file_path) | |
| pages = [] | |
| for page in doc: | |
| text = page.get_text() | |
| if text.strip(): | |
| pages.append(text) | |
| doc.close() | |
| return "\n\n".join(pages) | |