| import os |
| from huggingface_hub import HfApi |
|
|
| |
| 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.") |
|
|