Spaces:
Sleeping
Sleeping
Update checks/health_check.py
Browse files- checks/health_check.py +13 -0
checks/health_check.py
CHANGED
@@ -3,6 +3,19 @@ import os
|
|
3 |
import requests
|
4 |
from typing import Dict, Tuple
|
5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
def check_model_endpoint(endpoint_uri: str) -> Tuple[bool, Dict]:
|
7 |
"""Comprehensive check of model endpoint health"""
|
8 |
# Basic availability check
|
|
|
3 |
import requests
|
4 |
from typing import Dict, Tuple
|
5 |
|
6 |
+
def check_with_prompt(endpoint_uri: str):
|
7 |
+
|
8 |
+
# Try a direct test of your endpoint
|
9 |
+
test_prompt = "Hello, how are you?"
|
10 |
+
response = requests.post(
|
11 |
+
endpoint_uri,
|
12 |
+
json={"inputs": test_prompt},
|
13 |
+
headers={"Authorization": f"Bearer {os.getenv('HF_TOKEN')}"}
|
14 |
+
)
|
15 |
+
print(response.json())
|
16 |
+
|
17 |
+
|
18 |
+
|
19 |
def check_model_endpoint(endpoint_uri: str) -> Tuple[bool, Dict]:
|
20 |
"""Comprehensive check of model endpoint health"""
|
21 |
# Basic availability check
|