File size: 1,590 Bytes
205b164
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/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()