Hi all,
I’ve been following the lectures and coding along, but due to library updates and differences between local model inference and deployment on Hugging Face, I ran into a few issues.
For those folks who look for quick fixes and to the point:
1. Set Python Version
After cloning the Hugging Face Space to your local machine, edit the README.md and add this line at the end:
python_version: '3.12'
This sets the Python version for your Space. If you are curious about the space configuration, here is the link.
2. Update requirements.txt
Use the following dependencies:
gradio==3.50.0
fastai==2.8.3
3. Adjust Gradio API Usage
Gradio’s API has changed slightly since Jeremy recorded the video. Update these two lines in app.py:
image = gr.Image()
label = gr.Label()
Push your changes and enjoy a smooth deployment!
For the Curious Minds – Recreating Jeremy’s Original Setup:
If you want to replicate the environment, probably the one that Jeremy used during the lecture, here’s what you need:
requirements.txt:
gradio==5.42.0
fastai==2.7.19
cloudpickle==3.1.1
In app.py:
image = gr.Image()
label = gr.Label()
Important:
If your model was exported using a newer version of fastai, it won’t work with 2.7.19 due to architectural changes. You’ll need to retrain and export your model using fastai==2.7.19. For local training, also include:
fastbook==0.0.26
Why These Changes Were Necessary:
I faced several deployment issues when following the lecture:
- My local setup used Python 3.12, but Hugging Face Spaces defaulted to 3.10.
- Fastai’s internal architecture changed between versions, causing incompatibility.
cloudpickleneeded to be updated for proper serialization.- Gradio’s API moved
ImageandLabelcomponents out of theinputsandoutputsmodules, and they no longer accept theshapeargument.
To avoid long deployment cycles and error debugging on Hugging Face, I set everything up locally using a Python 3.10 virtual environment, resolved the issues, and then pushed the working version.
Hope this helps anyone starting the lectures in 2025!