Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -346,14 +346,24 @@ def timegpt_fcst():
|
|
346 |
|
347 |
df = df.rename(columns={ds_col: 'ds', y_col: 'y'})
|
348 |
|
|
|
349 |
id_col = 'ts_test'
|
350 |
df['unique_id']=id_col
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
351 |
freq = determine_frequency(df)
|
352 |
|
353 |
if st.sidebar.button("Submit"):
|
354 |
forecast_df = nixtla_client.forecast(
|
355 |
df=df,
|
356 |
h=7,
|
|
|
|
|
357 |
freq=freq,
|
358 |
level=[90]
|
359 |
)
|
@@ -394,11 +404,17 @@ def timegpt_anom():
|
|
394 |
|
395 |
id_col = 'ts_test'
|
396 |
df['unique_id']=id_col
|
397 |
-
|
|
|
|
|
|
|
|
|
398 |
|
399 |
if st.sidebar.button("Submit"):
|
400 |
anom_df = nixtla_client.detect_anomalies(
|
401 |
df=df,
|
|
|
|
|
402 |
freq=freq,
|
403 |
level=90
|
404 |
)
|
|
|
346 |
|
347 |
df = df.rename(columns={ds_col: 'ds', y_col: 'y'})
|
348 |
|
349 |
+
st.write(df)
|
350 |
id_col = 'ts_test'
|
351 |
df['unique_id']=id_col
|
352 |
+
df = df[['unique_id','ds','y']]
|
353 |
+
st.session_state.df = df
|
354 |
+
|
355 |
+
st.session_state.ds_col = ds_col
|
356 |
+
st.session_state.y_col = y_col
|
357 |
+
|
358 |
+
|
359 |
freq = determine_frequency(df)
|
360 |
|
361 |
if st.sidebar.button("Submit"):
|
362 |
forecast_df = nixtla_client.forecast(
|
363 |
df=df,
|
364 |
h=7,
|
365 |
+
time_col='ds',
|
366 |
+
target_col='y',
|
367 |
freq=freq,
|
368 |
level=[90]
|
369 |
)
|
|
|
404 |
|
405 |
id_col = 'ts_test'
|
406 |
df['unique_id']=id_col
|
407 |
+
df = df[['unique_id','ds','y']]
|
408 |
+
st.session_state.df = df
|
409 |
+
|
410 |
+
st.session_state.ds_col = ds_col
|
411 |
+
st.session_state.y_col = y_col
|
412 |
|
413 |
if st.sidebar.button("Submit"):
|
414 |
anom_df = nixtla_client.detect_anomalies(
|
415 |
df=df,
|
416 |
+
time_col='ds',
|
417 |
+
target_col='y',
|
418 |
freq=freq,
|
419 |
level=90
|
420 |
)
|