Spaces:
Sleeping
Sleeping
cjell commited on
Commit ·
3e8d9d1
1
Parent(s): 23c6a53
changing piost
Browse files
app.py
CHANGED
|
@@ -21,7 +21,7 @@ class Query(BaseModel):
|
|
| 21 |
text: str
|
| 22 |
|
| 23 |
# Prediction route (POST /)
|
| 24 |
-
@app.post("/")
|
| 25 |
def predict(query: Query):
|
| 26 |
result = classifier(query.text)[0]
|
| 27 |
return {"label": result["label"], "score": result["score"]}
|
|
|
|
| 21 |
text: str
|
| 22 |
|
| 23 |
# Prediction route (POST /)
|
| 24 |
+
@app.post("/predict")
|
| 25 |
def predict(query: Query):
|
| 26 |
result = classifier(query.text)[0]
|
| 27 |
return {"label": result["label"], "score": result["score"]}
|
test.py
CHANGED
|
@@ -16,12 +16,11 @@ except Exception:
|
|
| 16 |
# --- Prediction request ---
|
| 17 |
print("\n🔹 Sending prediction request...")
|
| 18 |
predict_resp = requests.post(
|
| 19 |
-
BASE_URL,
|
| 20 |
json={"text": "Congratulations! You've won a free cruise!"},
|
| 21 |
headers={"Content-Type": "application/json"},
|
| 22 |
timeout=30
|
| 23 |
)
|
| 24 |
-
|
| 25 |
print("Prediction status:", predict_resp.status_code)
|
| 26 |
|
| 27 |
try:
|
|
|
|
| 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:
|