Update main.py
Browse files
main.py
CHANGED
|
@@ -167,7 +167,7 @@ def extract_page_text(reader, page_num):
|
|
| 167 |
return reader.pages[page_num].extract_text() or ""
|
| 168 |
return ""
|
| 169 |
|
| 170 |
-
def process_with_gemini(
|
| 171 |
prompt = """Analyze this bank statement and extract transactions in JSON format with these fields:
|
| 172 |
- Date (format DD/MM/YYYY)
|
| 173 |
- Description
|
|
@@ -243,7 +243,7 @@ def process_pdf_pages(pdf_file):
|
|
| 243 |
if isinstance(txns, list):
|
| 244 |
all_txns.extend(txns)
|
| 245 |
|
| 246 |
-
return all_txns
|
| 247 |
|
| 248 |
# --------- Chat Endpoint ---------
|
| 249 |
@app.route("/chat", methods=["POST"])
|
|
@@ -312,7 +312,7 @@ def upload_statements():
|
|
| 312 |
fs.collection("transactions").add(record)
|
| 313 |
stored_count += 1
|
| 314 |
|
| 315 |
-
return jsonify({"message": f"Stored {stored_count} transactions"
|
| 316 |
|
| 317 |
# --------- Endpoint: Retrieve or Generate Financial Statement ---------
|
| 318 |
|
|
|
|
| 167 |
return reader.pages[page_num].extract_text() or ""
|
| 168 |
return ""
|
| 169 |
|
| 170 |
+
def process_with_gemini(text: str) -> str::
|
| 171 |
prompt = """Analyze this bank statement and extract transactions in JSON format with these fields:
|
| 172 |
- Date (format DD/MM/YYYY)
|
| 173 |
- Description
|
|
|
|
| 243 |
if isinstance(txns, list):
|
| 244 |
all_txns.extend(txns)
|
| 245 |
|
| 246 |
+
return all_txns
|
| 247 |
|
| 248 |
# --------- Chat Endpoint ---------
|
| 249 |
@app.route("/chat", methods=["POST"])
|
|
|
|
| 312 |
fs.collection("transactions").add(record)
|
| 313 |
stored_count += 1
|
| 314 |
|
| 315 |
+
return jsonify({"message": f"Stored {stored_count} transactions"}), 200
|
| 316 |
|
| 317 |
# --------- Endpoint: Retrieve or Generate Financial Statement ---------
|
| 318 |
|