Download src/pdf_runtime.py from Nerdur/Odisej: direct link, hf CLI and curl.
- Browser
- Download file 510 Bytes
-
https://huggingface.co/spaces/Nerdur/Odisej/resolve/main/src/pdf_runtime.py
- Command line
-
hf download hf://spaces/Nerdur/Odisej/src/pdf_runtime.py
-
curl -L -o pdf_runtime.py https://huggingface.co/spaces/Nerdur/Odisej/resolve/main/src/pdf_runtime.py
510 Bytes
| """Small helpers for optional PDF runtime dependencies.""" | |
| PDF_VIEWER_PYMUPDF_MISSING = ( | |
| "PDF viewer requires PyMuPDF. Install optional PDF dependencies with " | |
| "`pip install -r requirements-optional.txt` (PyMuPDF is AGPL-3.0)." | |
| ) | |
| def load_pymupdf_for_pdf_viewer(): | |
| """Return the PyMuPDF module, or raise a user-facing setup hint.""" | |
| try: | |
| import fitz # PyMuPDF, optional | |
| except ImportError as exc: | |
| raise RuntimeError(PDF_VIEWER_PYMUPDF_MISSING) from exc | |
| return fitz | |