Spaces:
Runtime error
Runtime error
Download fixmodel.py from rafaared/helloworld: direct link, hf CLI and curl.
- Browser
- Download file 392 Bytes
-
https://huggingface.co/spaces/rafaared/helloworld/resolve/main/fixmodel.py
- Command line
-
hf download hf://spaces/rafaared/helloworld/fixmodel.py
-
curl -L -o fixmodel.py https://huggingface.co/spaces/rafaared/helloworld/resolve/main/fixmodel.py
392 Bytes
| from fastai.vision.all import * | |
| from pathlib import Path, WindowsPath | |
| def is_cat(x): return x[0].isupper() | |
| # Load the learner | |
| learn = load_learner('model.pkl') | |
| # Replace the WindowsPath object with the platform-independent Path object | |
| if isinstance(learn.path, WindowsPath): | |
| learn.path = Path(learn.path) | |
| # Save the learner with the modified path object | |
| learn.export('model_fixed.pkl') |