File size: 2,062 Bytes
4411958
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
53
54
55
56
57
58
59
60
61
62
63
64
65
"""
Quick script to check your HF Space logs and status
"""
import os
from huggingface_hub import HfApi

# Configuration
YOUR_USERNAME = "nocapdev"
SPACE_NAME = "my-gradio-momask"
TOKEN = os.getenv("HUGGINGFACE_TOKEN")

def check_space_status():
    print("=" * 70)
    print(" " * 20 + "HF Space Status Check")
    print("=" * 70)

    if not TOKEN:
        print("❌ ERROR: HUGGINGFACE_TOKEN not set")
        print("Set it with: $env:HUGGINGFACE_TOKEN = 'hf_your_token'")
        return

    api = HfApi(token=TOKEN)
    repo_id = f"{YOUR_USERNAME}/{SPACE_NAME}"

    try:
        # Get space info
        print(f"\n📍 Checking Space: {repo_id}")
        print(f"   URL: https://huggingface.co/spaces/{repo_id}")

        # Get runtime info
        runtime = api.get_space_runtime(repo_id=repo_id)

        print(f"\n🔧 Runtime Status:")
        print(f"   Stage: {runtime.stage}")
        print(f"   Hardware: {runtime.hardware}")
        print(f"   SDK: {runtime.sdk}")

        if runtime.stage == "RUNNING":
            print("   ✅ Space is RUNNING")
        elif runtime.stage == "BUILDING":
            print("   ⏳ Space is BUILDING...")
        else:
            print(f"   ⚠️  Stage: {runtime.stage}")

        print("\n💡 Next Steps:")
        print(f"   1. Visit: https://huggingface.co/spaces/{repo_id}")
        print(f"   2. Click 'Logs' tab to see detailed output")
        print(f"   3. Look for errors or 'Using device: cpu/cuda'")

        if runtime.hardware and 'cpu' in runtime.hardware.lower():
            print("\n⚠️  WARNING: Using CPU hardware")
            print("   • Generation will be VERY slow (10-30 minutes)")
            print("   • Consider upgrading to GPU in Space Settings")

    except Exception as e:
        print(f"\n❌ Error checking space: {e}")
        print("\nManual check:")
        print(f"   Visit: https://huggingface.co/spaces/{repo_id}")
        print("   Check the Logs tab for detailed information")

    print("\n" + "=" * 70)

if __name__ == "__main__":
    check_space_status()