Add multipart/form-data and signed URL support to /glmocr/parse#161
Closed
majcheradam wants to merge 1 commit intozai-org:mainfrom
Closed
Add multipart/form-data and signed URL support to /glmocr/parse#161majcheradam wants to merge 1 commit intozai-org:mainfrom
majcheradam wants to merge 1 commit intozai-org:mainfrom
Conversation
- server.py: accept multipart/form-data (file uploads via "files" field, remote URLs via "urls" field) and http/https signed URLs in JSON mode; all inputs converted to data: URIs in-memory, no temp files written - image_utils.py: add pdf_bytes_to_images_pil and pdf_bytes_to_images_pil_iter for in-memory PDF rendering via pypdfium2 - page_loader.py: add data:application/pdf;base64 branch in _load_source and _iter_source; add _load_pdf_bytes and _iter_pdf_bytes methods Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
server.py:/glmocr/parsenow acceptsmultipart/form-data(uploaded files viafilesfield, remote URLs viaurlsfield) andhttp/httpssigned URLs in JSON mode; all inputs are converted todata:URIs in-memory — no temp files writtenimage_utils.py: addedpdf_bytes_to_images_pilandpdf_bytes_to_images_pil_iterfor zero-disk-I/O PDF rendering via pypdfium2 in-memory bytes APIpage_loader.py: addeddata:application/pdf;base64,...routing in_load_source/_iter_source; added_load_pdf_bytesand_iter_pdf_bytesmethodsUsage
File upload (multipart):
Signed URL (JSON):
Mixed (multipart + remote URLs):
Test plan
images— verify fetched in-memoryurlsfield — verify resolved correctlyapplication/jsonwithfile://anddata:URLs still works🤖 Generated with Claude Code