|
import pandas as pd |
|
import matplotlib.pyplot as plt |
|
import plotly.express as px |
|
import streamlit as st |
|
from transformers import pipeline |
|
|
|
|
|
uploaded_file = st.file_uploader("Upload Expense CSV", type="csv") |
|
|
|
if uploaded_file is not None: |
|
|
|
df = pd.read_csv(uploaded_file) |
|
|
|
|
|
st.write("First few rows of the dataset:", df.head()) |
|
|
|
|
|
model_name = 'distilbert-base-uncased' |
|
classifier = pipeline('zero-shot-classification', model=model_name) |
|
|
|
|
|
categories = ["Groceries", "Rent", "Utilities", "Entertainment", "Dining", "Transportation", "Salary"] |
|
|
|
|
|
def categorize_expense(description): |
|
result = classifier(description, candidate_labels=categories) |
|
return result['labels'][0] |
|
|
|
|
|
df['Category'] = df['Description'].apply(categorize_expense) |
|
|
|
|
|
|