muzzamilanwaar123 commited on
Commit
11bd8cf
·
verified ·
1 Parent(s): a278857

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -117,8 +117,11 @@ def extract_text_from_pdf(pdf_path):
117
  text += page_text + "\n"
118
  if text.strip():
119
  return text
120
- except:
121
- pass
 
 
 
122
 
123
  # Fallback: OCR
124
  print("No selectable text found. Running OCR...")
 
117
  text += page_text + "\n"
118
  if text.strip():
119
  return text
120
+ except Exception as e:
121
+ print("pypdf failed:", e)
122
+
123
+ # If no text, give a clear message (no OCR attempt)
124
+ return "❌ This PDF is scanned or does not contain selectable text. Please upload a text‑based PDF."
125
 
126
  # Fallback: OCR
127
  print("No selectable text found. Running OCR...")