AttributeError: Exception occured in `ProgressCallback` when calling event `before_validate`: 'NoneType' object has no attribute 'update'

Summary

I’m trying to create a web using streamlit and make predictions using a trained fastai model. But I get the error;
AttributeError: Exception occured in ProgressCallback when calling event before_validate: ‘NoneType’ object has no attribute ‘update’

Steps to reproduce

Here’s my code

Code snippet:

import streamlit as st
from PIL import Image
import fastai
from fastai.vision.all import *
from fastai.text.all import *
from fastai.collab import *
from fastai.tabular.all import *
import warnings
warnings.filterwarnings('ignore')
import tempfile

st.write(fastai.__version__)

img2 = PILImage.create('/content/drive/MyDrive/septoria tmt.jpg')

model = load_learner('/content/drive/MyDrive/beepAI/tomato_fastai_model.pkl')

st.write(model.predict(img2))

Expected behavior:

I expected the model to make predictions on the image

Actual behavior:

I get the below error;
AttributeError: Exception occured in ProgressCallback when calling event before_validate: ‘NoneType’ object has no attribute ‘update’

Debug info

  • Streamlit version: 2.7.12
  • Python version: 3.10.12

I’m using Localtunnel to test the code before actual deployment

Additional information

Other people have had this exact problem, but no one actually helped to provide an answer