Spaces:
Sleeping
Sleeping
File size: 839 Bytes
d7c0aa2 |
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 requests
def check_api_health(api_url: str) -> dict:
"""Check if the backend API is healthy"""
try:
response = requests.get(f"{api_url}/api/v1/health", timeout=10)
response.raise_for_status()
return response.json()
except Exception as e:
return {"status": "unhealthy", "error": str(e)}
def analyze_notes(api_url: str, provider_notes: str) -> dict:
"""Send provider notes to backend API for analysis"""
try:
payload = {"provider_notes": provider_notes}
response = requests.post(
f"{api_url}/api/v1/analyze",
json=payload,
headers={"Content-Type": "application/json"},
timeout=60
)
response.raise_for_status()
return response.json()
except Exception as e:
return {"error": str(e)} |