Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -11,7 +11,8 @@ from st_aggrid import AgGrid
|
|
11 |
from nixtla import NixtlaClient
|
12 |
import os
|
13 |
|
14 |
-
|
|
|
15 |
@st.cache_resource
|
16 |
def load_model(path, freq):
|
17 |
nf = NeuralForecast.load(path=path)
|
@@ -358,6 +359,7 @@ def timegpt_fcst():
|
|
358 |
columns.pop(columns.index('unique_id'))
|
359 |
opt = columns
|
360 |
y_col = st.selectbox("Select Target column", options=opt, index=0)
|
|
|
361 |
|
362 |
df = df.rename(columns={ds_col: 'ds', y_col: 'y'})
|
363 |
|
@@ -377,17 +379,15 @@ def timegpt_fcst():
|
|
377 |
if st.sidebar.button("Submit"):
|
378 |
forecast_df = nixtla_client.forecast(
|
379 |
df=df,
|
380 |
-
h=
|
381 |
freq=freq,
|
382 |
level=[90]
|
383 |
)
|
|
|
384 |
|
385 |
-
st.
|
386 |
-
|
387 |
-
forecast_df,
|
388 |
-
level=[90],
|
389 |
-
max_insample_length=365
|
390 |
-
))
|
391 |
|
392 |
|
393 |
|
@@ -435,11 +435,11 @@ def timegpt_anom():
|
|
435 |
freq=freq,
|
436 |
level=90
|
437 |
)
|
|
|
438 |
|
439 |
-
st.
|
440 |
-
|
441 |
-
anom_df
|
442 |
-
))
|
443 |
|
444 |
|
445 |
|
|
|
11 |
from nixtla import NixtlaClient
|
12 |
import os
|
13 |
|
14 |
+
st.set_page_config(layout='wide')
|
15 |
+
|
16 |
@st.cache_resource
|
17 |
def load_model(path, freq):
|
18 |
nf = NeuralForecast.load(path=path)
|
|
|
359 |
columns.pop(columns.index('unique_id'))
|
360 |
opt = columns
|
361 |
y_col = st.selectbox("Select Target column", options=opt, index=0)
|
362 |
+
h = st.number_input("Forecast horizon", value=14)
|
363 |
|
364 |
df = df.rename(columns={ds_col: 'ds', y_col: 'y'})
|
365 |
|
|
|
379 |
if st.sidebar.button("Submit"):
|
380 |
forecast_df = nixtla_client.forecast(
|
381 |
df=df,
|
382 |
+
h=h,
|
383 |
freq=freq,
|
384 |
level=[90]
|
385 |
)
|
386 |
+
st.session_state.forecast_df = forecast_df
|
387 |
|
388 |
+
if 'forecast_df' in st.session_state:
|
389 |
+
forecast_df = st.session_state.forecast_df
|
390 |
+
st.pyplot(nixtla_client.plot(df, forecast_df, level=[90]))
|
|
|
|
|
|
|
391 |
|
392 |
|
393 |
|
|
|
435 |
freq=freq,
|
436 |
level=90
|
437 |
)
|
438 |
+
st.session_state.anom_df = anom_df
|
439 |
|
440 |
+
if 'anom_df' in st.session_state:
|
441 |
+
anom_df = st.session_state.anom_df
|
442 |
+
st.pyplot(nixtla_client.plot(df, anom_df))
|
|
|
443 |
|
444 |
|
445 |
|