| import os | |
| import requests | |
| API_BASE_URL = os.environ.get("API_BASE_URL", "http://localhost:8000") | |
| def call_predict(samples: list[dict]) -> list[dict]: | |
| response = requests.post(f"{API_BASE_URL}/predict", json=samples) | |
| response.raise_for_status() | |
| return response.json() | |
| def call_predict_all(samples: list[dict]) -> dict[str, list[dict]]: | |
| response = requests.post(f"{API_BASE_URL}/predict-all-models", json=samples) | |
| response.raise_for_status() | |
| return response.json() | |
| def check_health() -> bool: | |
| try: | |
| response = requests.get(f"{API_BASE_URL}/health", timeout=3) | |
| return response.status_code == 200 | |
| except requests.ConnectionError: | |
| return False | |