Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -38,7 +38,12 @@ def extract_text_from_pdf(pdf_path, is_scanned=False):
|
|
| 38 |
def parse_bank_statement(text):
|
| 39 |
"""Parse bank statement using LLM with fallback to rule-based parser"""
|
| 40 |
cleaned_text = re.sub(r'[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]', '', text)
|
| 41 |
-
safe_text =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
|
| 43 |
# Craft precise prompt for LLM
|
| 44 |
prompt = f"""
|
|
|
|
| 38 |
def parse_bank_statement(text):
|
| 39 |
"""Parse bank statement using LLM with fallback to rule-based parser"""
|
| 40 |
cleaned_text = re.sub(r'[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]', '', text)
|
| 41 |
+
safe_text = (
|
| 42 |
+
cleaned_text
|
| 43 |
+
.replace("{", "{{")
|
| 44 |
+
.replace("}", "}}")
|
| 45 |
+
.replace("%", "%%")
|
| 46 |
+
)
|
| 47 |
|
| 48 |
# Craft precise prompt for LLM
|
| 49 |
prompt = f"""
|