Spaces:
Sleeping
Sleeping
Update backend/main.py
Browse files- backend/main.py +3 -1
backend/main.py
CHANGED
|
@@ -123,7 +123,7 @@ def extract_text_from_pdf(pdf_path: str) -> str:
|
|
| 123 |
text, re.IGNORECASE | re.DOTALL | re.MULTILINE
|
| 124 |
)
|
| 125 |
|
| 126 |
-
if methods_match and len(methods_match.group(
|
| 127 |
text = methods_match.group(1)
|
| 128 |
else:
|
| 129 |
chars = len(text)
|
|
@@ -133,6 +133,8 @@ def extract_text_from_pdf(pdf_path: str) -> str:
|
|
| 133 |
if len(words) > 1500:
|
| 134 |
text = " ".join(words[:1500])
|
| 135 |
|
|
|
|
|
|
|
| 136 |
return text
|
| 137 |
|
| 138 |
|
|
|
|
| 123 |
text, re.IGNORECASE | re.DOTALL | re.MULTILINE
|
| 124 |
)
|
| 125 |
|
| 126 |
+
if methods_match and len(methods_match.group(1).strip()) > 200:
|
| 127 |
text = methods_match.group(1)
|
| 128 |
else:
|
| 129 |
chars = len(text)
|
|
|
|
| 133 |
if len(words) > 1500:
|
| 134 |
text = " ".join(words[:1500])
|
| 135 |
|
| 136 |
+
text = text.replace("\n", " ")
|
| 137 |
+
|
| 138 |
return text
|
| 139 |
|
| 140 |
|