azrai99 commited on
Commit
932e273
·
verified ·
1 Parent(s): 7181a20

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -10
app.py CHANGED
@@ -209,7 +209,7 @@ def load_default():
209
  return df
210
 
211
  def transfer_learning_forecasting():
212
- st.title("Transfer Learning Forecasting")
213
  st.markdown("""
214
  Instant time series forecasting and visualization by using various pre-trained deep neural network-based model trained on M4 data.
215
  """)
@@ -217,14 +217,30 @@ def transfer_learning_forecasting():
217
  nhits_models, timesnet_models, lstm_models, tft_models = load_all_models()
218
 
219
  with st.sidebar.expander("Upload and Configure Dataset", expanded=True):
220
- uploaded_file = st.file_uploader("Upload your time series data (CSV)", type=["csv"])
221
- if uploaded_file:
222
- df = pd.read_csv(uploaded_file)
223
- st.session_state.df = df
 
 
 
 
 
 
224
  else:
225
- df = load_default()
226
- st.session_state.df = df
227
-
 
 
 
 
 
 
 
 
 
 
228
  columns = df.columns.tolist() # Convert Index to list
229
  opt = []
230
  ds_col = st.selectbox("Select Date/Time column", options=columns, index=columns.index('ds') if 'ds' in columns else 0)
@@ -467,9 +483,9 @@ def timegpt_anom():
467
 
468
 
469
  pg = st.navigation({
470
- "NeuralForecast": [
471
  # Load pages from functions
472
- st.Page(transfer_learning_forecasting, title="Transfer Learning Forecasting", default=True, icon=":material/query_stats:"),
473
  st.Page(dynamic_forecasting, title="Dynamic Forecasting", icon=":material/monitoring:"),
474
  ],
475
  "TimeGPT": [
 
209
  return df
210
 
211
  def transfer_learning_forecasting():
212
+ st.title("Zero-shot Forecasting")
213
  st.markdown("""
214
  Instant time series forecasting and visualization by using various pre-trained deep neural network-based model trained on M4 data.
215
  """)
 
217
  nhits_models, timesnet_models, lstm_models, tft_models = load_all_models()
218
 
219
  with st.sidebar.expander("Upload and Configure Dataset", expanded=True):
220
+ if 'uploaded_file' not in st.session_state:
221
+ uploaded_file = st.file_uploader("Upload your time series data (CSV)", type=["csv"])
222
+ if uploaded_file:
223
+ df = pd.read_csv(uploaded_file)
224
+ st.session_state.df = df
225
+ st.session_state.uploaded_file = uploaded_file
226
+ else:
227
+ df = load_default()
228
+ st.session_state.df = df
229
+
230
  else:
231
+ if st.checkbox("Upload a new file(CSV)"):
232
+ uploaded_file = st.file_uploader("Upload your time series data (CSV)", type=["csv"])
233
+ if uploaded_file:
234
+ df = pd.read_csv(uploaded_file)
235
+ st.session_state.df = df
236
+ st.session_state.uploaded_file = uploaded_file
237
+ else:
238
+ df = load_default()
239
+ st.session_state.df = df
240
+ else:
241
+ uploaded_file = st.session_state.uploaded_file
242
+
243
+
244
  columns = df.columns.tolist() # Convert Index to list
245
  opt = []
246
  ds_col = st.selectbox("Select Date/Time column", options=columns, index=columns.index('ds') if 'ds' in columns else 0)
 
483
 
484
 
485
  pg = st.navigation({
486
+ "Neuralforecast": [
487
  # Load pages from functions
488
+ st.Page(transfer_learning_forecasting, title="Zero-shot Forecasting", default=True, icon=":material/query_stats:"),
489
  st.Page(dynamic_forecasting, title="Dynamic Forecasting", icon=":material/monitoring:"),
490
  ],
491
  "TimeGPT": [