Spaces:
Sleeping
Sleeping
Update backend/main.py
Browse files- 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()
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 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(
|