engralimalik commited on
Commit
161fe1c
·
verified ·
1 Parent(s): 77dc4ed

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -2
app.py CHANGED
@@ -66,8 +66,8 @@ if uploaded_file is not None:
66
  )
67
  st.plotly_chart(fig2)
68
 
69
- # Budget and Alerts Example (Tracking if any category exceeds its budget)
70
- budgets = {
71
  "Groceries": 300,
72
  "Rent": 1000,
73
  "Utilities": 150,
@@ -76,6 +76,17 @@ if uploaded_file is not None:
76
  "Transportation": 120,
77
  }
78
 
 
 
 
 
 
 
 
 
 
 
 
79
  # Track if any category exceeds its budget
80
  df['Budget_Exceeded'] = df.apply(lambda row: row['Amount'] > budgets.get(row['Category'], 0), axis=1)
81
 
 
66
  )
67
  st.plotly_chart(fig2)
68
 
69
+ # Default Budget Values
70
+ default_budgets = {
71
  "Groceries": 300,
72
  "Rent": 1000,
73
  "Utilities": 150,
 
76
  "Transportation": 120,
77
  }
78
 
79
+ # Sliders for adjusting the monthly budget
80
+ st.write("Adjust your monthly budget for each category:")
81
+
82
+ budgets = {}
83
+ for category in default_budgets:
84
+ budgets[category] = st.slider(f"Budget for {category} ($)",
85
+ min_value=0,
86
+ max_value=2000,
87
+ value=default_budgets[category],
88
+ step=50)
89
+
90
  # Track if any category exceeds its budget
91
  df['Budget_Exceeded'] = df.apply(lambda row: row['Amount'] > budgets.get(row['Category'], 0), axis=1)
92