Spaces:
Sleeping
Sleeping
| """ | |
| Environment setup to handle library conflicts and dependencies | |
| """ | |
| import os | |
| import logging | |
| def setup_environment(): | |
| """Configure environment variables for the application""" | |
| # Disable TensorFlow warnings and prevent it from being loaded | |
| # This allows Transformers to work without TensorFlow dependencies | |
| os.environ["TF_CPP_MIN_LOG_LEVEL"] = "3" # Disable TensorFlow logging | |
| os.environ["USE_TORCH"] = "1" # Tell Transformers to use PyTorch | |
| os.environ["USE_TF"] = "0" # Tell Transformers not to use TensorFlow | |
| # Configure logging | |
| logging.basicConfig( | |
| level=logging.INFO, | |
| format='%(asctime)s - %(levelname)s - %(message)s' | |
| ) | |
| # Log environment settings | |
| logging.info("Environment configured: PyTorch enabled, TensorFlow disabled") | |
| return True | |