""" This file runs automatically when Python starts, before any imports. Used to fix HuggingFace Spaces OMP_NUM_THREADS issue. """ import os # Fix OMP_NUM_THREADS before numexpr tries to use it if 'OMP_NUM_THREADS' in os.environ: value = str(os.environ['OMP_NUM_THREADS']) if not value.isdigit(): os.environ['OMP_NUM_THREADS'] = '4' print(f"Fixed OMP_NUM_THREADS from '{value}' to '4'")