File size: 803 Bytes
85768b6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
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.")