Spaces:
Running
Running
File size: 1,559 Bytes
9a6a4dc |
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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
#!/usr/bin/env python3
"""
Push deployment-ready GAIA agent to Hugging Face Space
"""
import os
import sys
from huggingface_hub import HfApi, upload_folder
from pathlib import Path
def push_to_huggingface():
"""Push the deployment-ready folder to Hugging Face Space."""
# Check for HF token
hf_token = os.getenv('HF_TOKEN')
if not hf_token:
print("β HF_TOKEN environment variable not found!")
print("Please set your Hugging Face token:")
print("export HF_TOKEN=your_token_here")
return False
# Initialize API
api = HfApi(token=hf_token)
# Space details
repo_id = "JoachimVC/gaia-enhanced-agent"
repo_type = "space"
print(f"π Pushing deployment-ready files to {repo_id}...")
try:
# Upload the entire deployment-ready folder
api.upload_folder(
folder_path=".",
repo_id=repo_id,
repo_type=repo_type,
commit_message="Remove .env file - use HF Spaces secrets for API keys (security best practice)",
ignore_patterns=[".git", "__pycache__", "*.pyc", ".DS_Store", "push_to_hf.py", ".env"]
)
print("β
Successfully pushed to Hugging Face Space!")
print(f"π View your space: https://huggingface.co/spaces/{repo_id}")
return True
except Exception as e:
print(f"β Error pushing to Hugging Face: {e}")
return False
if __name__ == "__main__":
success = push_to_huggingface()
sys.exit(0 if success else 1) |