Download fix_numpy.py from BSJ2004/new_hosp: direct link, hf CLI and curl.
- Browser
- Download file 739 Bytes
-
https://huggingface.co/spaces/BSJ2004/new_hosp/resolve/main/fix_numpy.py
- Command line
-
hf download hf://spaces/BSJ2004/new_hosp/fix_numpy.py
-
curl -L -o fix_numpy.py https://huggingface.co/spaces/BSJ2004/new_hosp/resolve/main/fix_numpy.py
739 Bytes
| # Configuration for fixing numpy._core import issue | |
| import os | |
| import sys | |
| def fix_numpy_import(): | |
| """Fix numpy._core import issue for Hugging Face Spaces""" | |
| try: | |
| # Force reinstall numpy with compatible version | |
| os.system("pip uninstall numpy -y") | |
| os.system("pip install numpy==1.26.4") | |
| # Force reload numpy | |
| if 'numpy' in sys.modules: | |
| del sys.modules['numpy'] | |
| import numpy as np | |
| print(f"✅ Numpy fixed and loaded successfully: {np.__version__}") | |
| return True | |
| except Exception as e: | |
| print(f"❌ Failed to fix numpy: {e}") | |
| return False | |
| if __name__ == "__main__": | |
| fix_numpy_import() | |