Spaces:
Running
Running
File size: 1,846 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 52 53 54 55 56 57 58 |
#!/usr/bin/env python3
"""
Upload updated files to Hugging Face Space using the API
"""
from huggingface_hub import HfApi
import os
def upload_files_to_space():
"""Upload the updated files to the Hugging Face Space"""
# Initialize the API
api = HfApi()
# Space details
repo_id = "JoachimVC/gaia-enhanced-agent"
repo_type = "space"
print(f"Uploading files to {repo_id}...")
# Files to upload with their paths
files_to_upload = [
("agents/enhanced_unified_agno_agent.py", "agents/enhanced_unified_agno_agent.py"),
("utils/simple_answer_formatter.py", "utils/simple_answer_formatter.py"),
("app.py", "app.py"),
("requirements.txt", "requirements.txt")
]
try:
for local_path, repo_path in files_to_upload:
if os.path.exists(local_path):
print(f"Uploading {local_path} -> {repo_path}")
api.upload_file(
path_or_fileobj=local_path,
path_in_repo=repo_path,
repo_id=repo_id,
repo_type=repo_type,
commit_message=f"Update {repo_path} with SimpleGAIAAnswerFormatter integration"
)
print(f"β Successfully uploaded {repo_path}")
else:
print(f"β File not found: {local_path}")
print(f"\nπ All files uploaded successfully to {repo_id}")
print(f"π Space should be rebuilding automatically...")
except Exception as e:
print(f"β Error uploading files: {e}")
return False
return True
if __name__ == "__main__":
success = upload_files_to_space()
if success:
print("\nβ
Deployment completed successfully!")
else:
print("\nβ Deployment failed!") |