Spaces:
Sleeping
Sleeping
Download app/utils/pdf_loader.py from thabsheeeeeer/DocBrain-API: direct link, hf CLI and curl.
- Browser
- Download file 265 Bytes
-
https://huggingface.co/spaces/thabsheeeeeer/DocBrain-API/resolve/main/app/utils/pdf_loader.py
- Command line
-
hf download hf://spaces/thabsheeeeeer/DocBrain-API/app/utils/pdf_loader.py
-
curl -L -o pdf_loader.py https://huggingface.co/spaces/thabsheeeeeer/DocBrain-API/resolve/main/app/utils/pdf_loader.py
265 Bytes
| import pdfplumber | |
| def extract_text(file_path): | |
| text = "" | |
| with pdfplumber.open(file_path) as pdf: | |
| for page in pdf.pages: | |
| page_text = page.extract_text() | |
| if page_text: | |
| text += page_text + "\n" | |
| return text |