3v324v23 commited on
Commit
033a9eb
·
1 Parent(s): 0a66c45

tryout no plot

Browse files
Files changed (1) hide show
  1. streamlit_simulation/app.py +14 -18
streamlit_simulation/app.py CHANGED
@@ -133,10 +133,11 @@ init_session_state()
133
 
134
  # ============================== Loaders ==============================
135
 
136
- @st.cache_data
137
- def load_lightgbm_model():
138
- with open(MODEL_PATH_LIGHTGBM, "rb") as f:
139
- return pickle.load(f)
 
140
 
141
  @st.cache_resource
142
  def load_transformer_model_and_dataset():
@@ -152,15 +153,9 @@ def load_transformer_model_and_dataset():
152
  model.to(device)
153
  model.eval()
154
 
155
- csv_path = hf_hub_download(
156
- repo_id="dlaj/energy-forecasting-files",
157
- filename="data/processed/energy_consumption_aggregated_cleaned.csv",
158
- repo_type="dataset"
159
- )
160
-
161
  # Datasets
162
- train_dataset = InformerDataset(data_split="train", forecast_horizon=FORECAST_HORIZON, random_seed=13, csv_path=csv_path)
163
- test_dataset = InformerDataset(data_split="test", forecast_horizon=FORECAST_HORIZON, random_seed=13, csv_path=csv_path)
164
  test_dataset.scaler = train_dataset.scaler
165
 
166
  return model, test_dataset, device
@@ -168,14 +163,15 @@ def load_transformer_model_and_dataset():
168
 
169
  @st.cache_data
170
  def load_data():
171
- csv_path = hf_hub_download(
172
- repo_id="dlaj/energy-forecasting-files",
173
- filename="data/processed/energy_consumption_aggregated_cleaned.csv",
174
- repo_type="dataset"
175
- )
176
- df = pd.read_csv(csv_path, parse_dates=["date"])
177
  return df
178
 
 
 
 
 
 
 
179
 
180
  # ============================== Utility Functions ==============================
181
 
 
133
 
134
  # ============================== Loaders ==============================
135
 
136
+ CSV_PATH_HF = hf_hub_download(
137
+ repo_id="dlaj/energy-forecasting-files",
138
+ filename="data/processed/energy_consumption_aggregated_cleaned.csv",
139
+ repo_type="dataset"
140
+ )
141
 
142
  @st.cache_resource
143
  def load_transformer_model_and_dataset():
 
153
  model.to(device)
154
  model.eval()
155
 
 
 
 
 
 
 
156
  # Datasets
157
+ train_dataset = InformerDataset(data_split="train", forecast_horizon=FORECAST_HORIZON, random_seed=13, csv_path=CSV_PATH_HF)
158
+ test_dataset = InformerDataset(data_split="test", forecast_horizon=FORECAST_HORIZON, random_seed=13, csv_path=CSV_PATH_HF)
159
  test_dataset.scaler = train_dataset.scaler
160
 
161
  return model, test_dataset, device
 
163
 
164
  @st.cache_data
165
  def load_data():
166
+ df = pd.read_csv(CSV_PATH_HF, parse_dates=["date"])
 
 
 
 
 
167
  return df
168
 
169
+ #Load lightgbm model
170
+ @st.cache_data
171
+ def load_lightgbm_model():
172
+ with open(MODEL_PATH_LIGHTGBM, "rb") as f:
173
+ return pickle.load(f)
174
+
175
 
176
  # ============================== Utility Functions ==============================
177