Spaces:
Running on Zero
Running on Zero
Upload app.py with huggingface_hub
Browse files76 unmodified lines7778798081828376 unmodified linesdef _load_pages(file_path: str):data = Path(file_path).read_bytes()if file_path.lower().endswith(".pdf"):pages = list(ocr_service.page_images(data))else:pages = [Image.open(io.BytesIO(data)).convert("RGB")]if not pages:76 unmodified lines777879808182838476 unmodified linesdef _load_pages(file_path: str):data = Path(file_path).read_bytes()if file_path.lower().endswith(".pdf"):# page_images() closes each rendered page once the generator advances -> copy eagerly.pages = [page.convert("RGB") for page in ocr_service.page_images(data)]else:pages = [Image.open(io.BytesIO(data)).convert("RGB")]if not pages:
app.py+2-1