File size: 739 Bytes
779e387
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# 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()