Spaces:
Sleeping
Sleeping
Streamlit application files added
Browse files- LSTM_predictions-final.csv +13 -0
- Prophet_predictions.csv +13 -0
- RNN_predictions-final.csv +13 -0
- app.py +56 -0
- requirements.txt +8 -0
LSTM_predictions-final.csv
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Date,Prediction
|
2 |
+
2022-01-31,321870080.0
|
3 |
+
2022-02-28,299647800.0
|
4 |
+
2022-03-31,339766940.0
|
5 |
+
2022-04-30,334998460.0
|
6 |
+
2022-05-31,350785380.0
|
7 |
+
2022-06-30,342564500.0
|
8 |
+
2022-07-31,356114430.0
|
9 |
+
2022-08-31,357524860.0
|
10 |
+
2022-09-30,346851840.0
|
11 |
+
2022-10-31,358977100.0
|
12 |
+
2022-11-30,347742500.0
|
13 |
+
2022-12-31,359557760.0
|
Prophet_predictions.csv
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Date,Prediction
|
2 |
+
2022-01-31,317881610.0590188
|
3 |
+
2022-02-28,293104833.38518673
|
4 |
+
2022-03-31,331135132.92652655
|
5 |
+
2022-04-30,327193033.51301265
|
6 |
+
2022-05-31,344923058.9539489
|
7 |
+
2022-06-30,340493712.42480046
|
8 |
+
2022-07-31,358751759.0707788
|
9 |
+
2022-08-31,365728493.44860756
|
10 |
+
2022-09-30,360607364.1991499
|
11 |
+
2022-10-31,379558692.5370447
|
12 |
+
2022-11-30,373912496.74845016
|
13 |
+
2022-12-31,393332601.9413679
|
RNN_predictions-final.csv
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Date,Prediction
|
2 |
+
2022-01-31,323736300.0
|
3 |
+
2022-02-28,293960030.0
|
4 |
+
2022-03-31,326672160.0
|
5 |
+
2022-04-30,317307230.0
|
6 |
+
2022-05-31,327673340.0
|
7 |
+
2022-06-30,317215900.0
|
8 |
+
2022-07-31,327947260.0
|
9 |
+
2022-08-31,327757340.0
|
10 |
+
2022-09-30,317391870.0
|
11 |
+
2022-10-31,327808030.0
|
12 |
+
2022-11-30,317342240.0
|
13 |
+
2022-12-31,327862300.0
|
app.py
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import pandas as pd
|
3 |
+
import plotly.express as px
|
4 |
+
|
5 |
+
# Function to load predictions
|
6 |
+
@st.cache_data
|
7 |
+
def load_predictions(filename):
|
8 |
+
data = pd.read_csv(filename)
|
9 |
+
data['Date'] = pd.to_datetime(data['Date']).dt.strftime('%Y-%m')
|
10 |
+
return data
|
11 |
+
|
12 |
+
# Title and Introduction with icons
|
13 |
+
st.title('πΉ 2022 Receipt Count Predictions')
|
14 |
+
st.markdown("## Explore the Receipt Count Predictions for the year 2022 π")
|
15 |
+
|
16 |
+
# Sidebar for model selection
|
17 |
+
st.sidebar.title("π Model Selection")
|
18 |
+
model_option = st.sidebar.selectbox(
|
19 |
+
'Choose a model:',
|
20 |
+
('LSTM', 'RNN', 'Prophet')
|
21 |
+
)
|
22 |
+
|
23 |
+
# Button to load predictions
|
24 |
+
if st.sidebar.button('Get Predictions'):
|
25 |
+
filename_map = {'LSTM': 'results/LSTM_predictions-final.csv',
|
26 |
+
'RNN': 'results/rnn_predictions-final.csv',
|
27 |
+
'Prophet': 'results/Prophet_predictions.csv'}
|
28 |
+
|
29 |
+
predictions = load_predictions(filename_map[model_option])
|
30 |
+
|
31 |
+
# Display Data Table
|
32 |
+
st.markdown("### Predicted Receipt Counts")
|
33 |
+
st.dataframe(predictions)
|
34 |
+
|
35 |
+
# Plotting Predictions and fixing the error
|
36 |
+
st.markdown("### Interactive Prediction Graph")
|
37 |
+
fig = px.line(predictions, x='Date', y='Prediction',
|
38 |
+
title=f'Monthly Predicted Receipt Counts for 2022 ({model_option} Model)',
|
39 |
+
markers=True)
|
40 |
+
st.plotly_chart(fig, use_container_width=True)
|
41 |
+
|
42 |
+
# Download links
|
43 |
+
st.markdown('## Download Results')
|
44 |
+
st.download_button(
|
45 |
+
label="Download Data as CSV",
|
46 |
+
data=predictions.to_csv(index=False).encode('utf-8'),
|
47 |
+
file_name='predictions.csv',
|
48 |
+
mime='text/csv',
|
49 |
+
)
|
50 |
+
|
51 |
+
st.download_button(
|
52 |
+
label="Download Plot as Image",
|
53 |
+
data=fig.to_image(format="png"),
|
54 |
+
file_name='predictions_plot.png',
|
55 |
+
mime='image/png',
|
56 |
+
)
|
requirements.txt
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
pandas
|
2 |
+
numpy
|
3 |
+
matplotlib
|
4 |
+
plotly
|
5 |
+
streamlit
|
6 |
+
scikit-learn
|
7 |
+
prophet
|
8 |
+
kaleido
|