Spaces:
Running
Running
Download rag/pdf_parser.py from Deign86/mathpulse-api-v3test: direct link, hf CLI and curl.
- Browser
- Download file 440 Bytes
-
https://huggingface.co/spaces/Deign86/mathpulse-api-v3test/resolve/main/rag/pdf_parser.py
- Command line
-
hf download hf://spaces/Deign86/mathpulse-api-v3test/rag/pdf_parser.py
-
curl -L -o pdf_parser.py https://huggingface.co/spaces/Deign86/mathpulse-api-v3test/resolve/main/rag/pdf_parser.py
440 Bytes
| import logging | |
| from .liteparse_utils import extract_text | |
| logger = logging.getLogger(__name__) | |
| def parse_pdf_layout(content: bytes): | |
| """Extract LiteParse text while preserving the legacy page-row contract.""" | |
| try: | |
| text = extract_text(content) | |
| return [{"page_number": 1, "text": text, "tables": []}] if text else [] | |
| except Exception as error: | |
| logger.error("Error parsing PDF: %s", error) | |
| raise | |