Spaces:
Running
Running
#!/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) |