cjell commited on
Commit
c56e8db
·
1 Parent(s): 3e8d9d1
Files changed (1) hide show
  1. test.py +6 -4
test.py CHANGED
@@ -1,10 +1,10 @@
1
  import requests
2
 
3
- BASE_URL = "http://cjell-spam-fastapi.hf.space/"
4
 
5
  # --- Health check ---
6
  print("🔹 Checking health endpoint...")
7
- health_resp = requests.get(BASE_URL)
8
  print("Health check status:", health_resp.status_code)
9
 
10
  try:
@@ -15,15 +15,17 @@ except Exception:
15
 
16
  # --- Prediction request ---
17
  print("\n🔹 Sending prediction request...")
 
18
  predict_resp = requests.post(
19
- BASE_URL + "predict", # <-- add "predict"
20
  json={"text": "Congratulations! You've won a free cruise!"},
21
  headers={"Content-Type": "application/json"},
22
  timeout=30
23
  )
 
24
  print("Prediction status:", predict_resp.status_code)
25
 
26
  try:
27
  print("Prediction JSON:", predict_resp.json())
28
  except Exception:
29
- print("Prediction raw text:", predict_resp.text[:500]) # first 500 chars
 
1
  import requests
2
 
3
+ BASE_URL = "http://cjell-spam-fastapi.hf.space"
4
 
5
  # --- Health check ---
6
  print("🔹 Checking health endpoint...")
7
+ health_resp = requests.get(BASE_URL + "/")
8
  print("Health check status:", health_resp.status_code)
9
 
10
  try:
 
15
 
16
  # --- Prediction request ---
17
  print("\n🔹 Sending prediction request...")
18
+
19
  predict_resp = requests.post(
20
+ BASE_URL + "/predict",
21
  json={"text": "Congratulations! You've won a free cruise!"},
22
  headers={"Content-Type": "application/json"},
23
  timeout=30
24
  )
25
+
26
  print("Prediction status:", predict_resp.status_code)
27
 
28
  try:
29
  print("Prediction JSON:", predict_resp.json())
30
  except Exception:
31
+ print("Prediction raw text:", predict_resp.text[:500])