Spaces:
Sleeping
Sleeping
File size: 840 Bytes
4a3e340 c56e8db 8a8fd9e 0cc3789 c56e8db 0cc3789 8a8fd9e 0cc3789 c56e8db 0cc3789 c56e8db 0cc3789 4a3e340 c56e8db 0cc3789 c56e8db | 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 26 27 28 29 30 31 32 | import requests
BASE_URL = "http://cjell-spam-fastapi.hf.space"
# --- Health check ---
print("🔹 Checking health endpoint...")
health_resp = requests.get(BASE_URL + "/")
print("Health check status:", health_resp.status_code)
try:
print("Health check JSON:", health_resp.json())
except Exception:
print("Health check raw text:", health_resp.text[:500]) # first 500 chars
# --- Prediction request ---
print("\n🔹 Sending prediction request...")
predict_resp = requests.post(
BASE_URL + "/predict",
json={"text": "Congratulations! You've won a free cruise!"},
headers={"Content-Type": "application/json"},
timeout=30
)
print("Prediction status:", predict_resp.status_code)
try:
print("Prediction JSON:", predict_resp.json())
except Exception:
print("Prediction raw text:", predict_resp.text[:500])
|