trish06 commited on
Commit
9f9465c
·
verified ·
1 Parent(s): 15bbd00

Update backend/main.py

Browse files
Files changed (1) hide show
  1. backend/main.py +5 -5
backend/main.py CHANGED
@@ -92,11 +92,11 @@ def extract_text_from_pdf(pdf_path: str) -> str:
92
  if page_text:
93
  text += page_text + "\n"
94
 
95
- if not text.strip() or len(text.strip()) < 500:
96
- raise ValueError(
97
- "Could not extract text — this may be a scanned/image-based PDF. "
98
- "Please use a text-based PDF."
99
- )
100
 
101
  # Try to isolate Methods section
102
  methods_match = re.search(
 
92
  if page_text:
93
  text += page_text + "\n"
94
 
95
+ if not text.strip():
96
+ raise ValueError("PDF text extraction failed.")
97
+
98
+ if len(text.strip()) < 500:
99
+ text = text[:2000]
100
 
101
  # Try to isolate Methods section
102
  methods_match = re.search(