Spaces:
Running
Running
Circhastic
commited on
Commit
•
47fbf7b
1
Parent(s):
e10970a
Quick fix app
Browse files- app.py +9 -38
- requirements.txt +1 -2
app.py
CHANGED
@@ -1,10 +1,6 @@
|
|
1 |
import streamlit as st
|
2 |
-
from streamlit_lottie import st_lottie_spinner
|
3 |
-
import json
|
4 |
-
import time
|
5 |
-
import requests
|
6 |
-
|
7 |
import pandas as pd
|
|
|
8 |
from datetime import datetime
|
9 |
|
10 |
import numpy as np
|
@@ -23,16 +19,6 @@ st.set_page_config(
|
|
23 |
initial_sidebar_state="expanded",
|
24 |
)
|
25 |
|
26 |
-
@st.cache_data
|
27 |
-
def load_lottieurl(url: str):
|
28 |
-
r = requests.get(url)
|
29 |
-
if r.status_code != 200:
|
30 |
-
return None
|
31 |
-
return r.json()
|
32 |
-
|
33 |
-
lottie_progress_url = "https://lottie.host/12c7a018-d6c9-4595-abab-2992e4117d95/TnBbTO5WR5.json"
|
34 |
-
lottie_progress = load_lottieurl(lottie_progress_url)
|
35 |
-
|
36 |
# Preprocessing
|
37 |
@st.cache_data
|
38 |
def merge(B, C, A):
|
@@ -148,20 +134,6 @@ def train_test(dataframe):
|
|
148 |
future_X = dataframe.iloc[0:,1:]
|
149 |
return (training_y, test_y, test_y_series, training_X, test_X, future_X)
|
150 |
|
151 |
-
# @st.cache_data
|
152 |
-
# def model_fitting(dataframe, Exo):
|
153 |
-
# futureModel = pm.auto_arima(dataframe['Sales'], X=Exo, start_p=1, start_q=1,
|
154 |
-
# test='adf',min_p=1,min_q=1,
|
155 |
-
# max_p=3, max_q=3, m=12,
|
156 |
-
# start_P=0, seasonal=True,
|
157 |
-
# d=None, D=1, trace=True,
|
158 |
-
# error_action='ignore',
|
159 |
-
# suppress_warnings=True,
|
160 |
-
# stepwise=True,
|
161 |
-
# maxiter=5)
|
162 |
-
# model = futureModel
|
163 |
-
# return model
|
164 |
-
|
165 |
@st.cache_data
|
166 |
def test_fitting(dataframe, Exo, trainY):
|
167 |
trainTestModel = auto_arima(X = Exo, y = trainY, start_p=1, start_q=1,
|
@@ -171,8 +143,7 @@ def test_fitting(dataframe, Exo, trainY):
|
|
171 |
d=None, D=1, trace=True,
|
172 |
error_action='ignore',
|
173 |
suppress_warnings=True,
|
174 |
-
stepwise=True
|
175 |
-
maxiter=5)
|
176 |
model = trainTestModel
|
177 |
return model
|
178 |
|
@@ -276,12 +247,10 @@ with st.sidebar:
|
|
276 |
st.write("Your uploaded data:")
|
277 |
st.write(df)
|
278 |
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
merge_sort(df)
|
284 |
-
series = group_to_three(df)
|
285 |
|
286 |
st.session_state.uploaded = True
|
287 |
|
@@ -323,7 +292,9 @@ if (st.session_state.uploaded):
|
|
323 |
col1, col2 = st.columns(2)
|
324 |
with col1:
|
325 |
col1.header("Sales Forecast")
|
326 |
-
|
|
|
|
|
327 |
# plt.figure(figsize=(18,10))
|
328 |
# plt.plot(df['Sales'], color='b', label = 'Actual Sales')
|
329 |
# plt.plot(test_y, color='b')
|
|
|
1 |
import streamlit as st
|
|
|
|
|
|
|
|
|
|
|
2 |
import pandas as pd
|
3 |
+
import time
|
4 |
from datetime import datetime
|
5 |
|
6 |
import numpy as np
|
|
|
19 |
initial_sidebar_state="expanded",
|
20 |
)
|
21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
# Preprocessing
|
23 |
@st.cache_data
|
24 |
def merge(B, C, A):
|
|
|
134 |
future_X = dataframe.iloc[0:,1:]
|
135 |
return (training_y, test_y, test_y_series, training_X, test_X, future_X)
|
136 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
137 |
@st.cache_data
|
138 |
def test_fitting(dataframe, Exo, trainY):
|
139 |
trainTestModel = auto_arima(X = Exo, y = trainY, start_p=1, start_q=1,
|
|
|
143 |
d=None, D=1, trace=True,
|
144 |
error_action='ignore',
|
145 |
suppress_warnings=True,
|
146 |
+
stepwise=True)
|
|
|
147 |
model = trainTestModel
|
148 |
return model
|
149 |
|
|
|
247 |
st.write("Your uploaded data:")
|
248 |
st.write(df)
|
249 |
|
250 |
+
df = drop(df)
|
251 |
+
df = date_format(df)
|
252 |
+
merge_sort(df)
|
253 |
+
series = group_to_three(df)
|
|
|
|
|
254 |
|
255 |
st.session_state.uploaded = True
|
256 |
|
|
|
292 |
col1, col2 = st.columns(2)
|
293 |
with col1:
|
294 |
col1.header("Sales Forecast")
|
295 |
+
chart_data = pd.DataFrame(np.random.randn(20, 3), columns=["Forecasted", "Predicted", "Actual Sale"])
|
296 |
+
col1.line_chart(chart_data)
|
297 |
+
# col1.line_chart(df['Sales'], x="Date", y="Actual Sales", color="#0000EE")
|
298 |
# plt.figure(figsize=(18,10))
|
299 |
# plt.plot(df['Sales'], color='b', label = 'Actual Sales')
|
300 |
# plt.plot(test_y, color='b')
|
requirements.txt
CHANGED
@@ -2,5 +2,4 @@ pmdarima
|
|
2 |
statsmodels
|
3 |
transformers
|
4 |
torch
|
5 |
-
streamlit
|
6 |
-
streamlit-lottie
|
|
|
2 |
statsmodels
|
3 |
transformers
|
4 |
torch
|
5 |
+
streamlit
|
|