manjunathainti commited on
Commit
3154606
·
1 Parent(s): c0b808b

Update app.py to adapt to dataset structure

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -9,14 +9,17 @@ import joblib
9
  # Load the dataset
10
  webtraffic_data = pd.read_csv("webtraffic.csv")
11
 
12
- # Ensure the 'Datetime' column is in datetime format
13
- webtraffic_data['Datetime'] = pd.to_datetime(webtraffic_data['Datetime'])
 
 
 
14
 
15
  # Load the pre-trained models
16
  sarima_model = joblib.load("sarima_model.pkl") # Load SARIMA model
17
  lstm_model = tf.keras.models.load_model("lstm_model.keras") # Load LSTM model
18
 
19
- # Load the scaler for LSTM if used during training (optional)
20
  scaler = joblib.load("scaler.pkl")
21
 
22
  # Function to generate predictions and plots
 
9
  # Load the dataset
10
  webtraffic_data = pd.read_csv("webtraffic.csv")
11
 
12
+ # Rename 'Hour Index' for easier use
13
+ webtraffic_data.rename(columns={"Hour Index": "Datetime"}, inplace=True)
14
+
15
+ # Create a datetime-like index for visualization purposes
16
+ webtraffic_data['Datetime'] = pd.to_datetime(webtraffic_data['Datetime'], unit='h', origin='unix')
17
 
18
  # Load the pre-trained models
19
  sarima_model = joblib.load("sarima_model.pkl") # Load SARIMA model
20
  lstm_model = tf.keras.models.load_model("lstm_model.keras") # Load LSTM model
21
 
22
+ # Load the scaler for LSTM (if used during training)
23
  scaler = joblib.load("scaler.pkl")
24
 
25
  # Function to generate predictions and plots