Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,12 @@ async def predict_pdf(file: UploadFile):
)

pdf_bytes = await file.read()
text = extract_text_from_bytes(pdf_bytes)
try:
text = extract_text_from_bytes(pdf_bytes)
except Exception as exc:
raise HTTPException(
status_code=422, detail="File is not a readable PDF"
) from exc
Comment thread
coderabbitai[bot] marked this conversation as resolved.

if not text.strip():
raise HTTPException(status_code=422, detail="PDF valid but not processable")
Expand Down
Loading