-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcheck_full_status.py
More file actions
25 lines (23 loc) · 886 Bytes
/
Copy pathcheck_full_status.py
File metadata and controls
25 lines (23 loc) · 886 Bytes
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
import os
import requests
import json
def load_token():
if os.path.exists('.env'):
with open('.env', 'r') as f:
for line in f:
if line.startswith('HF_TOKEN='):
return line.strip().split('=', 1)[1].strip('"\'')
return os.environ.get('HF_TOKEN')
token = load_token()
headers = {"Authorization": f"Bearer {token}"} if token else {}
r = requests.get("https://huggingface.co/api/spaces/Adityavanjre/Project-K", headers=headers)
if r.status_code == 200:
data = r.json()
print("Stage:", data.get("runtime", {}).get("stage"))
print("SDK:", data.get("sdk"))
print("Hardware:", data.get("runtime", {}).get("hardware"))
print("Storage:", data.get("runtime", {}).get("storage"))
print("Full Runtime:")
print(json.dumps(data.get("runtime", {}), indent=2))
else:
print("Error:", r.status_code, r.text)