Spaces:
Sleeping
Sleeping
github-actions[bot]
chore: Sync deployment files to HF Space (excludes test data to stay within storage limits)
b25b944 Download app/processing.py from f007kht/osprey-experimental: direct link, hf CLI and curl.
- Browser
- Download file 1.4 kB
-
https://huggingface.co/spaces/f007kht/osprey-experimental/resolve/main/app/processing.py
- Command line
-
hf download hf://spaces/f007kht/osprey-experimental/app/processing.py
-
curl -L -o processing.py https://huggingface.co/spaces/f007kht/osprey-experimental/resolve/main/app/processing.py
1.4 kB
| """Document processing orchestration. | |
| Module 1 - Osprey Backend: Document processing application. | |
| """ | |
| from typing import Dict, Any, Optional, Tuple | |
| # This module will contain the main document processing logic | |
| # Currently a stub - will be populated by extracting logic from app.py | |
| def detect_pdf_text_layer(pdf_bytes: bytes, max_pages_check: int = 3) -> Tuple[bool, list]: | |
| """ | |
| Detect if PDF has a text layer by checking first few pages. | |
| Args: | |
| pdf_bytes: PDF file bytes | |
| max_pages_check: Maximum number of pages to check | |
| Returns: | |
| Tuple of (has_text_layer, page_texts) | |
| """ | |
| # Stub - will be extracted from app.py | |
| return False, [] | |
| def should_disable_ocr_for_page1(osd_fail_count: int) -> bool: | |
| """Determine if OCR should be disabled based on OSD failure count. | |
| Args: | |
| osd_fail_count: Number of OSD failures | |
| Returns: | |
| True if OCR should be disabled | |
| """ | |
| # Stub - will be extracted from app.py | |
| return False | |
| def normalize_ocr_engine_name(engine) -> str: | |
| """Normalize OCR engine name for consistent logging. | |
| Args: | |
| engine: OCR engine object or name | |
| Returns: | |
| Normalized engine name string | |
| """ | |
| # Stub - will be extracted from app.py | |
| return str(engine) if engine else "unknown" | |