Update app.py
Browse files
app.py
CHANGED
@@ -32,8 +32,9 @@ if uploaded_file:
|
|
32 |
st.write("Here are the first few entries in your file for format verification:")
|
33 |
st.write(df.head())
|
34 |
|
35 |
-
# Ensure 'Amount' is numeric
|
36 |
df['Amount'] = pd.to_numeric(df['Amount'], errors='coerce')
|
|
|
37 |
|
38 |
# Initialize Hugging Face model for zero-shot classification
|
39 |
classifier = pipeline('zero-shot-classification', model='roberta-large-mnli')
|
@@ -66,14 +67,15 @@ if uploaded_file:
|
|
66 |
"Transportation": transportation_budget
|
67 |
}
|
68 |
|
69 |
-
#
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
|
|
|
|
74 |
|
75 |
# Filter data by date range
|
76 |
-
df['Date'] = pd.to_datetime(df['Date'])
|
77 |
df_filtered = df[(df['Date'] >= pd.to_datetime(start_date)) & (df['Date'] <= pd.to_datetime(end_date))]
|
78 |
|
79 |
# Track if any category exceeds its budget
|
|
|
32 |
st.write("Here are the first few entries in your file for format verification:")
|
33 |
st.write(df.head())
|
34 |
|
35 |
+
# Ensure 'Amount' is numeric and 'Date' is in datetime format
|
36 |
df['Amount'] = pd.to_numeric(df['Amount'], errors='coerce')
|
37 |
+
df['Date'] = pd.to_datetime(df['Date'])
|
38 |
|
39 |
# Initialize Hugging Face model for zero-shot classification
|
40 |
classifier = pipeline('zero-shot-classification', model='roberta-large-mnli')
|
|
|
67 |
"Transportation": transportation_budget
|
68 |
}
|
69 |
|
70 |
+
# Get the minimum and maximum dates from the uploaded file
|
71 |
+
min_date = df['Date'].min()
|
72 |
+
max_date = df['Date'].max()
|
73 |
+
|
74 |
+
# Add a date slider for start and end date based on data from the uploaded file
|
75 |
+
start_date = st.sidebar.date_input("Start Date", min_date)
|
76 |
+
end_date = st.sidebar.date_input("End Date", max_date)
|
77 |
|
78 |
# Filter data by date range
|
|
|
79 |
df_filtered = df[(df['Date'] >= pd.to_datetime(start_date)) & (df['Date'] <= pd.to_datetime(end_date))]
|
80 |
|
81 |
# Track if any category exceeds its budget
|