Error when trying to display a Pycaret chart on streamlit app

Hi there,

I am creating a streamlit app with charts that forecast crypto prices. I’ve created my charts with ML models using Pycaret and the model runs fine on its own, but when I try to display the final chart in streamlit it doesn’t work. I get the following error:

OSError: [WinError 6] The handle is invalid.

Here is a link to my public repository, the problem is in main.py where I am trying to create my streamlit app. GitHub - gedghill/AE2

Here is a code snippet:
btc = data[[‘BTC-USD’]]

Set up PyCaret environment

s = setup(data=btc,
target = ‘BTC-USD’,
#transform_target=‘log’,
fh=30, # Forecast horizon
session_id=123,
fold_strategy=‘expanding’,
seasonal_period=‘D’,
#fold_spans=“adaptive”,
numeric_imputation_target = ‘drift’)
prophet = create_model(‘prophet’, verbose = False)
arima = create_model(‘arima’, verbose=False)
tuned_prophet = tune_model(prophet)
tuned_arima = tune_model(arima)

Predictions

final_prophet = finalize_model(tuned_prophet)
prophet_predictions = predict_model(final_prophet)
#Plo prophet model forecast
btc_prophet = plot_model(final_prophet, plot=‘forecast’, display_format=‘streamlit’)
final_arima = finalize_model(tuned_arima)
arima_predictions = predict_model(final_arima)
#Plot arima model forecast
btc_arima =plot_model(final_arima, plot=‘forecast’, display_format=‘streamlit’)
st.plotly_chart(btc_prophet)
st.plotly_chart(btc_arima)

I am running all of this in VSCode, in a new virtual environment that I created where I installed Pycaret first, and then Streamlit (I have version 1.44.1)
Any help would be greatly appreciated! Thanks so much!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.