viraj-421 commited on
Commit
8aff2a3
·
verified ·
1 Parent(s): e9787aa

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. check_logs.py +24 -0
check_logs.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import requests
2
+ import json
3
+
4
+ def get_space_logs(space_id):
5
+ url = f"https://huggingface.co/api/spaces/{space_id}"
6
+ response = requests.get(url)
7
+
8
+ if response.status_code == 200:
9
+ data = response.json()
10
+ print("Space Status:", data.get("runtime", {}).get("stage"))
11
+
12
+ # Get logs if available via API
13
+ logs_url = f"https://huggingface.co/api/spaces/{space_id}/logs"
14
+ logs_response = requests.get(logs_url)
15
+ if logs_response.status_code == 200:
16
+ print("\n----- RECENT LOGS -----")
17
+ print(logs_response.text)
18
+ else:
19
+ print("Could not fetch logs via API API might require authentication for this Space.")
20
+ else:
21
+ print(f"Failed to fetch space info: {response.status_code}")
22
+
23
+ if __name__ == "__main__":
24
+ get_space_logs("viraj-421/MedAdapt-SAM-AI")