Spaces:
Sleeping
Sleeping
| #!/usr/bin/env python3 | |
| """Deploy Docker space with .env token loading""" | |
| import os | |
| import sys | |
| from pathlib import Path | |
| from dotenv import load_dotenv | |
| # Load .env file | |
| env_file = Path("C:/repos/longonot/local/.env") | |
| if env_file.exists(): | |
| load_dotenv(env_file) | |
| # Get token | |
| hf_token = os.getenv('HF_TOKEN') or os.getenv('HUGGING_FACE_HUB_TOKEN') | |
| if not hf_token: | |
| print("[ERROR] No HuggingFace token found in .env!") | |
| sys.exit(1) | |
| # Set environment variable | |
| os.environ['HUGGING_FACE_HUB_TOKEN'] = hf_token | |
| # Now import and run the deployment | |
| sys.path.insert(0, str(Path(__file__).parent)) | |
| from deploy_to_hf import deploy_to_huggingface | |
| if __name__ == "__main__": | |
| deploy_to_huggingface() | |