File size: 1,508 Bytes
fbb1eb0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
"""
Fetch Hugging Face Space build logs and analyze errors with DeepSeek
"""
from huggingface_hub import HfApi
import requests
import os

api = HfApi()
REPO_ID = "Kraft102/widgetdc-cortex"

print("=" * 80)
print("  FETCHING HUGGING FACE SPACE BUILD LOGS")
print("=" * 80)
print()

try:
    # Get space info
    space_info = api.space_info(repo_id=REPO_ID)
    
    print(f"📊 Space: {REPO_ID}")
    print(f"   Runtime: {space_info.runtime}")
    print()
    
    # Try to get logs via API
    token = os.getenv("HF_TOKEN")
    if token:
        headers = {"Authorization": f"Bearer {token}"}
        logs_url = f"https://huggingface.co/api/spaces/{REPO_ID}/logs"
        
        response = requests.get(logs_url, headers=headers)
        if response.status_code == 200:
            logs = response.text
            print("📋 BUILD LOGS:")
            print("-" * 80)
            print(logs)
            print("-" * 80)
        else:
            print(f"⚠️  Could not fetch logs: HTTP {response.status_code}")
    else:
        print("⚠️  HF_TOKEN not set - cannot fetch detailed logs")
        print()
        print("Manual steps:")
        print("1. Visit: https://huggingface.co/spaces/Kraft102/widgetdc-cortex")
        print("2. Click 'Logs' tab")
        print("3. Copy build error messages")
    
except Exception as e:
    print(f"❌ Error: {e}")
    print()
    print("Visit Space manually:")
    print("https://huggingface.co/spaces/Kraft102/widgetdc-cortex")

print()
print("=" * 80)