Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -251,12 +251,38 @@ def forecast_time_series(df, model_type, horizon, max_steps,y_col):
|
|
251 |
forecast_results = {}
|
252 |
forecast_results[model_type] = generate_forecast(model, df, tag='retrain')
|
253 |
|
|
|
|
|
254 |
for model_name, forecast_df in forecast_results.items():
|
255 |
plot_forecasts(forecast_df, df, f'{model_name} Forecast for {y_col}')
|
256 |
|
257 |
end_time = time.time() # End timing
|
258 |
time_taken = end_time - start_time
|
259 |
st.success(f"Time taken for {model_type} forecast: {time_taken:.2f} seconds")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
260 |
|
261 |
@st.cache_data
|
262 |
def load_default():
|
@@ -339,30 +365,30 @@ def transfer_learning_forecasting():
|
|
339 |
time_taken = end_time - start_time
|
340 |
st.success(f"Time taken for {model_choice} forecast: {time_taken:.2f} seconds")
|
341 |
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
st.markdown('You can download Input and Forecast Data below')
|
346 |
-
tab_insample, tab_forecast = st.tabs(
|
347 |
-
["Input data", "Forecast"]
|
348 |
-
)
|
349 |
-
|
350 |
-
with tab_insample:
|
351 |
-
df_grid = df.drop(columns="unique_id")
|
352 |
-
st.write(df_grid)
|
353 |
-
# grid_table = AgGrid(
|
354 |
-
# df_grid,
|
355 |
-
# theme="alpine",
|
356 |
-
# )
|
357 |
|
358 |
-
|
359 |
-
|
360 |
-
|
|
|
|
|
|
|
|
|
361 |
st.write(df_grid)
|
362 |
# grid_table = AgGrid(
|
363 |
# df_grid,
|
364 |
# theme="alpine",
|
365 |
# )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
366 |
|
367 |
|
368 |
def dynamic_forecasting():
|
|
|
251 |
forecast_results = {}
|
252 |
forecast_results[model_type] = generate_forecast(model, df, tag='retrain')
|
253 |
|
254 |
+
st.session_state.forecast_results = forecast_results
|
255 |
+
|
256 |
for model_name, forecast_df in forecast_results.items():
|
257 |
plot_forecasts(forecast_df, df, f'{model_name} Forecast for {y_col}')
|
258 |
|
259 |
end_time = time.time() # End timing
|
260 |
time_taken = end_time - start_time
|
261 |
st.success(f"Time taken for {model_type} forecast: {time_taken:.2f} seconds")
|
262 |
+
if 'forecast_results' in st.session_state:
|
263 |
+
forecast_results = st.session_state.forecast_results
|
264 |
+
|
265 |
+
st.markdown('You can download Input and Forecast Data below')
|
266 |
+
tab_insample, tab_forecast = st.tabs(
|
267 |
+
["Input data", "Forecast"]
|
268 |
+
)
|
269 |
+
|
270 |
+
with tab_insample:
|
271 |
+
df_grid = df.drop(columns="unique_id")
|
272 |
+
st.write(df_grid)
|
273 |
+
# grid_table = AgGrid(
|
274 |
+
# df_grid,
|
275 |
+
# theme="alpine",
|
276 |
+
# )
|
277 |
+
|
278 |
+
with tab_forecast:
|
279 |
+
if model_choice in forecast_results:
|
280 |
+
df_grid = forecast_results[model_choice]
|
281 |
+
st.write(df_grid)
|
282 |
+
# grid_table = AgGrid(
|
283 |
+
# df_grid,
|
284 |
+
# theme="alpine",
|
285 |
+
# )
|
286 |
|
287 |
@st.cache_data
|
288 |
def load_default():
|
|
|
365 |
time_taken = end_time - start_time
|
366 |
st.success(f"Time taken for {model_choice} forecast: {time_taken:.2f} seconds")
|
367 |
|
368 |
+
if 'forecast_results' in st.session_state:
|
369 |
+
forecast_results = st.session_state.forecast_results
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
370 |
|
371 |
+
st.markdown('You can download Input and Forecast Data below')
|
372 |
+
tab_insample, tab_forecast = st.tabs(
|
373 |
+
["Input data", "Forecast"]
|
374 |
+
)
|
375 |
+
|
376 |
+
with tab_insample:
|
377 |
+
df_grid = df.drop(columns="unique_id")
|
378 |
st.write(df_grid)
|
379 |
# grid_table = AgGrid(
|
380 |
# df_grid,
|
381 |
# theme="alpine",
|
382 |
# )
|
383 |
+
|
384 |
+
with tab_forecast:
|
385 |
+
if model_choice in forecast_results:
|
386 |
+
df_grid = forecast_results[model_choice]
|
387 |
+
st.write(df_grid)
|
388 |
+
# grid_table = AgGrid(
|
389 |
+
# df_grid,
|
390 |
+
# theme="alpine",
|
391 |
+
# )
|
392 |
|
393 |
|
394 |
def dynamic_forecasting():
|