Hugging_face_Openenv / upload_to_hf.py
SushCodex's picture
Upload 14 files
fc163a0 verified
raw
history blame contribute delete
883 Bytes
import os
from huggingface_hub import HfApi
# 1. Configuration
repo_id = "SushCodex/Hugging_face_Openenv"
token = os.getenv("HF_TOKEN") # Or paste your token here string: "your_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=".", # Upload current directory
repo_id=repo_id,
repo_type="space",
token=token,
path_in_repo=".",
ignore_patterns=[".git", ".pyc", "__pycache__"] # Skip git and cache
)
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.")