Spaces:
Sleeping
Sleeping
File size: 729 Bytes
3c39943 |
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 27 28 |
#!/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()
|