Spaces:
Sleeping
Sleeping
Download test_pdf.py from Rindhuja/intelligent-doc-api: direct link, hf CLI and curl.
- Browser
- Download file 510 Bytes
-
https://huggingface.co/spaces/Rindhuja/intelligent-doc-api/resolve/main/test_pdf.py
- Command line
-
hf download hf://spaces/Rindhuja/intelligent-doc-api/test_pdf.py
-
curl -L -o test_pdf.py https://huggingface.co/spaces/Rindhuja/intelligent-doc-api/resolve/main/test_pdf.py
510 Bytes
| import sys | |
| import os | |
| from document_loader import extract_pdf_chunks | |
| if __name__ == "__main__": | |
| if len(sys.argv) < 2: | |
| print("Usage: python test_pdf.py path_to_pdf") | |
| sys.exit(1) | |
| pdf_path = sys.argv[1] | |
| print(f"Reading {pdf_path}...") | |
| chunks = extract_pdf_chunks(pdf_path) | |
| print(f"Extracted {len(chunks)} chunks.") | |
| if chunks: | |
| print("First chunk preview:") | |
| print(chunks[0]['content'][:100]) | |
| print("...") | |
| print("Success!") | |