yetessam commited on
Commit
d767aea
·
verified ·
1 Parent(s): 060bcfa

Create checks/endpoint_check.py

Browse files
Files changed (1) hide show
  1. checks/endpoint_check.py +16 -0
checks/endpoint_check.py ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import requests
2
+ import sys
3
+
4
+ def is_huggingface_endpoint(endpoint: str):
5
+ try:
6
+ headers = {"Authorization": "Bearer YOUR_HUGGINGFACE_API_KEY"}
7
+ response = requests.get(endpoint, headers=headers)
8
+
9
+ if response.status_code == 200 and "model" in response.json():
10
+ return True
11
+ else:
12
+ print("This is NOT a Hugging Face Inference Endpoint.")
13
+ return False
14
+ except requests.exceptions.RequestException as e:
15
+ print(f"Request failed: {e}")
16
+ return False