Update app.py
Browse files92 unmodified lines939495969798369 unmodified lines46846947047147247347492 unmodified linesfuture[column] = self.data[column].iloc[-1] # Use last known valueforecast = self.model.predict(future)return forecastexcept Exception as e:print(f"Error predicting with Prophet model: {str(e)}")369 unmodified linesst.plotly_chart(fig, use_container_width=True)# Create forecast components plot using Plotlycomponents = predictor.model.predict_components(predictions)n_components = len(components.columns)fig_components = make_subplots(rows=n_components, cols=1,92 unmodified lines93949596979899100101102103104105369 unmodified lines47547647747847948048148292 unmodified linesfuture[column] = self.data[column].iloc[-1] # Use last known valueforecast = self.model.predict(future)# Calculate componentsforecast['trend'] = forecast['trend']forecast['yearly'] = forecast['yearly'] if 'yearly' in forecast.columns else 0forecast['weekly'] = forecast['weekly'] if 'weekly' in forecast.columns else 0forecast['daily'] = forecast['daily'] if 'daily' in forecast.columns else 0return forecastexcept Exception as e:print(f"Error predicting with Prophet model: {str(e)}")369 unmodified linesst.plotly_chart(fig, use_container_width=True)# Create forecast components plot using Plotly# Instead of using predict_components, we'll extract the components from the predictions DataFramecomponents = predictions[['trend', 'yearly', 'weekly', 'daily']]n_components = len(components.columns)fig_components = make_subplots(rows=n_components, cols=1,
app.py+9-1