Spaces:
Sleeping
Sleeping
| #!/usr/bin/env python3 | |
| """ | |
| Deploy Ubuntu Development Environment to Hugging Face Spaces | |
| """ | |
| import os | |
| from pathlib import Path | |
| def main(): | |
| HF_TOKEN = "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" | |
| USERNAME = "shk-bd" | |
| SPACE_NAME = "ubuntu-dev-env" | |
| # Check if git repository exists | |
| if not Path(".git").exists(): | |
| print("β Error: Not a git repository. Run 'git init' first.") | |
| return | |
| # Configure git | |
| os.system("git config user.name 'shk-bd'") | |
| os.system(f"git config user.email 'shk-bd@users.noreply.huggingface.co'") | |
| # Add remote if not exists | |
| os.system(f"git remote add origin https://huggingface.co/spaces/{USERNAME}/{SPACE_NAME}") | |
| print("π Deploying to Hugging Face Spaces...") | |
| print(f" Space: https://{USERNAME}.hf.space") | |
| print("") | |
| # Push to create the Space | |
| result = os.system("git push -u origin master") | |
| if result == 0: | |
| print("") | |
| print("β Deployment successful!") | |
| print("") | |
| print("Your Space is being built and will be available in 2-3 minutes at:") | |
| print(f" https://{USERNAME}.hf.space") | |
| print("") | |
| print("Access methods:") | |
| print(" 1. Web Terminal: Open the Space URL in your browser") | |
| print(f" 2. SSH: ssh root@{USERNAME}.hf.space (password: ubuntu)") | |
| print("") | |
| else: | |
| print("") | |
| print("β Deployment failed. Check your credentials and try again.") | |
| print("") | |
| print("Alternative: Upload files manually at https://huggingface.co/new-space") | |
| if __name__ == "__main__": | |
| main() | |