OPENSPEC_Hackhathon / upload_to_hf.py
SushCodex's picture
Upload 14 files
85768b6 verified
raw
history blame contribute delete
803 Bytes
import os
from huggingface_hub import HfApi
# 1. Configuration
repo_id = "SushCodex/Hugging_face_Openenv"
token = os.getenv("HF_TOKEN")
if not token:
token = input("Please enter your Hugging Face Write Token: ")
api = HfApi()
print(f"πŸš€ Uploading Folder to Space: {repo_id}...")
try:
api.upload_folder(
folder_path=".",
repo_id=repo_id,
repo_type="space",
token=token,
path_in_repo=".",
ignore_patterns=[".git*", ".venv*", "*__pycache__*", "*.pyc"]
)
print("\nβœ… SUCCESS: Your OpenEnv project is now live on Hugging Face Spaces!")
print(f"πŸ”— View it here: https://huggingface.co/spaces/{repo_id}")
except Exception as e:
print(f"\n❌ UPLOAD FAILED: {e}")
print("\nTip: Ensure your token has 'WRITE' permissions.")