Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import pandas as pd
|
3 |
+
from extract import extract_upi_transactions
|
4 |
+
from clean import clean_upi_data
|
5 |
+
from analysis import analyze_spending_pattern, get_financial_advice
|
6 |
+
from visualize import plot_spending_by_category
|
7 |
+
|
8 |
+
def process_pdf(file):
|
9 |
+
df = extract_upi_transactions(file.name)
|
10 |
+
df = clean_upi_data(df)
|
11 |
+
analysis = analyze_spending_pattern(df)
|
12 |
+
advice = get_financial_advice(df)
|
13 |
+
plot_spending_by_category(df)
|
14 |
+
|
15 |
+
return df, analysis, advice
|
16 |
+
|
17 |
+
interface = gr.Interface(
|
18 |
+
fn=process_pdf,
|
19 |
+
inputs=gr.File(),
|
20 |
+
outputs=[gr.Dataframe(), "text", "text"],
|
21 |
+
title="UPI Financial Analyzer",
|
22 |
+
description="Upload your UPI transaction statement to get insights and recommendations."
|
23 |
+
)
|
24 |
+
|
25 |
+
if __name__ == "__main__":
|
26 |
+
interface.launch()
|