Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -333,57 +333,20 @@ def empty_df():
|
|
333 |
"Credit", "Closing Balance", "Category"])
|
334 |
|
335 |
# Gradio Interface
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
# if __name__ == "__main__":
|
352 |
-
# interface.launch()
|
353 |
-
with gr.Blocks(title="AI Bank Statement Parser") as interface:
|
354 |
-
gr.Markdown("# AI Bank Statement Parser")
|
355 |
-
gr.Markdown("Extract structured transaction data from PDF/Excel bank statements")
|
356 |
-
|
357 |
-
with gr.Row():
|
358 |
-
file_input = gr.File(label="Upload Bank Statement (PDF/Excel)")
|
359 |
-
|
360 |
-
with gr.Row():
|
361 |
-
submit_btn = gr.Button("Process Statement", variant="primary")
|
362 |
-
|
363 |
-
with gr.Row():
|
364 |
-
dataframe_output = gr.Dataframe(
|
365 |
-
label="Parsed Transactions",
|
366 |
-
headers=["Date", "Description", "Amount", "Debit", "Credit", "Closing Balance", "Category"],
|
367 |
-
datatype=["date", "str", "number", "number", "number", "number", "str"]
|
368 |
-
)
|
369 |
-
|
370 |
-
with gr.Row():
|
371 |
-
download_pdf = gr.File(label="Download Report", interactive=False)
|
372 |
-
download_btn = gr.Button("Generate PDF Report")
|
373 |
-
|
374 |
-
# Processing function
|
375 |
-
submit_btn.click(
|
376 |
-
fn=process_file,
|
377 |
-
inputs=[file_input],
|
378 |
-
outputs=[dataframe_output, download_pdf]
|
379 |
-
)
|
380 |
-
|
381 |
-
# Download button handler
|
382 |
-
download_btn.click(
|
383 |
-
fn=lambda df: generate_pdf_report(df) if df is not None and not df.empty else None,
|
384 |
-
inputs=[dataframe_output],
|
385 |
-
outputs=[download_pdf]
|
386 |
-
)
|
387 |
|
388 |
if __name__ == "__main__":
|
389 |
interface.launch()
|
|
|
333 |
"Credit", "Closing Balance", "Category"])
|
334 |
|
335 |
# Gradio Interface
|
336 |
+
interface = gr.Interface(
|
337 |
+
fn=process_file,
|
338 |
+
inputs=[
|
339 |
+
gr.File(label="Upload Bank Statement (PDF/Excel)")
|
340 |
+
],
|
341 |
+
outputs=gr.Dataframe(
|
342 |
+
label="Parsed Transactions",
|
343 |
+
headers=["Date", "Description", "Amount", "Debit", "Credit", "Closing Balance", "Category"],
|
344 |
+
datatype=["date", "str", "number", "number", "number", "number", "str"]
|
345 |
+
),
|
346 |
+
title="AI Bank Statement Parser",
|
347 |
+
description="Extract structured transaction data from PDF/Excel bank statements",
|
348 |
+
allow_flagging="never"
|
349 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
350 |
|
351 |
if __name__ == "__main__":
|
352 |
interface.launch()
|