The issue can be resolved by installing a previous version of scikit-learn using the command !pip install scikit-learn==1.3.1. I created a dummy dataset and trained the model on it, and the model works well for me. Please refer to this gist.
!pip install scikit-learn==1.3.1