Recently apps Fastai + Gradio in hugging face return UnboundLocalError

Hello, I’m a beginnner.

Has anyone faced this? applications deployed on Hugging Face with FastAI and GRadio ( in a Gradio Space) that were working correctly a few days ago now produce a runtime error when attempting to modify them, even if you try to run the app with original version.

Error:

File “/app/app.py”, line 5, in
learn = load_learner(‘pantallas.pkl’)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.12/site-packages/fastai/learner.py”, line 465, in load_learner
res.dls.cpu()
^^^
UnboundLocalError: cannot access local variable ‘res’ where it is not associated with a value

I tried to change versions of Fastai,Python,Torch,Gradio but nothing works, always the error.

Thanks in advance.

After checking the packages included in the building of the Huggingface Gradio space I find out that plum-dispatch package was missing. I’ve included in the requeriments and finally the app deployed works.

These are the packages versions included in the requirements.txt file:
(Python version 3.13)

fastai==2.8.5
plum-dispatch==2.6.1
torch==2.8.0
gradio
scikit-image