File size: 780 Bytes
dab9ea3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import gradio as gr
import pandas as pd
from extract import extract_upi_transactions
from clean import clean_upi_data
from analysis import analyze_spending_pattern, get_financial_advice
from visualize import plot_spending_by_category

def process_pdf(file):
    df = extract_upi_transactions(file.name)
    df = clean_upi_data(df)
    analysis = analyze_spending_pattern(df)
    advice = get_financial_advice(df)
    plot_spending_by_category(df)
    
    return df, analysis, advice

interface = gr.Interface(
    fn=process_pdf,
    inputs=gr.File(),
    outputs=[gr.Dataframe(), "text", "text"],
    title="UPI Financial Analyzer",
    description="Upload your UPI transaction statement to get insights and recommendations."
)

if __name__ == "__main__":
    interface.launch()