Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -15,6 +15,7 @@ st.title("Expense Tracker")
|
|
| 15 |
# Define the path for reading CSV file
|
| 16 |
DATA_FILE = 'expenses.csv'
|
| 17 |
|
|
|
|
| 18 |
# Functions
|
| 19 |
def load_data():
|
| 20 |
'''
|
|
@@ -43,6 +44,7 @@ categories = ['Groceries', 'Transport', 'Bills', 'Takeout', 'Entertainment', 'Ot
|
|
| 43 |
if 'expenses' not in st.session_state:
|
| 44 |
st.session_state['expenses'] = load_data()
|
| 45 |
|
|
|
|
| 46 |
# Adding expense
|
| 47 |
with st.form("expense_form"):
|
| 48 |
# Input for entering expense amount, with min value of 1 pence
|
|
@@ -100,9 +102,7 @@ else:
|
|
| 100 |
|
| 101 |
|
| 102 |
|
| 103 |
-
|
| 104 |
# PART 4
|
| 105 |
-
|
| 106 |
if 'file_processed' not in st.session_state:
|
| 107 |
st.session_state['file_processed'] = False
|
| 108 |
|
|
@@ -110,6 +110,7 @@ if 'file_processed' not in st.session_state:
|
|
| 110 |
# Upload file from user's computer
|
| 111 |
uploaded_file = st.file_uploader("Import Expense Data", type="csv")
|
| 112 |
|
|
|
|
| 113 |
# Checks if a file is uploaded and if it hasn't already been processed
|
| 114 |
if uploaded_file is not None and not st.session_state['file_processed']:
|
| 115 |
|
|
|
|
| 15 |
# Define the path for reading CSV file
|
| 16 |
DATA_FILE = 'expenses.csv'
|
| 17 |
|
| 18 |
+
|
| 19 |
# Functions
|
| 20 |
def load_data():
|
| 21 |
'''
|
|
|
|
| 44 |
if 'expenses' not in st.session_state:
|
| 45 |
st.session_state['expenses'] = load_data()
|
| 46 |
|
| 47 |
+
|
| 48 |
# Adding expense
|
| 49 |
with st.form("expense_form"):
|
| 50 |
# Input for entering expense amount, with min value of 1 pence
|
|
|
|
| 102 |
|
| 103 |
|
| 104 |
|
|
|
|
| 105 |
# PART 4
|
|
|
|
| 106 |
if 'file_processed' not in st.session_state:
|
| 107 |
st.session_state['file_processed'] = False
|
| 108 |
|
|
|
|
| 110 |
# Upload file from user's computer
|
| 111 |
uploaded_file = st.file_uploader("Import Expense Data", type="csv")
|
| 112 |
|
| 113 |
+
|
| 114 |
# Checks if a file is uploaded and if it hasn't already been processed
|
| 115 |
if uploaded_file is not None and not st.session_state['file_processed']:
|
| 116 |
|