Corrected code
Browse files- TestAPI.py +19 -19
- model_weights.pth +1 -1
TestAPI.py
CHANGED
|
@@ -3,7 +3,7 @@ import json
|
|
| 3 |
import os
|
| 4 |
|
| 5 |
|
| 6 |
-
ROOT_API = "https://
|
| 7 |
|
| 8 |
|
| 9 |
def call_greets_json():
|
|
@@ -75,21 +75,21 @@ def call_predict_api(text: str, aspect: str) -> dict:
|
|
| 75 |
|
| 76 |
|
| 77 |
if __name__ == "__main__":
|
| 78 |
-
response = call_greets_json()
|
| 79 |
-
print(response)
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
|
|
|
| 3 |
import os
|
| 4 |
|
| 5 |
|
| 6 |
+
ROOT_API = "https://Samin7479-ABSAAPI.hf.space"
|
| 7 |
|
| 8 |
|
| 9 |
def call_greets_json():
|
|
|
|
| 75 |
|
| 76 |
|
| 77 |
if __name__ == "__main__":
|
| 78 |
+
# response = call_greets_json()
|
| 79 |
+
# print(response)
|
| 80 |
+
test_cases = [
|
| 81 |
+
{"text": "The food was great but the service was slow", "aspect": "food"},
|
| 82 |
+
{"text": "The ambiance is nice but very crowded", "aspect": "ambiance"}
|
| 83 |
+
]
|
| 84 |
+
for case in test_cases:
|
| 85 |
+
result = call_predict_api(case["text"], case["aspect"])
|
| 86 |
+
print(f"\nInput: text='{case['text']}', aspect='{case['aspect']}'")
|
| 87 |
+
if result["status"] == "success":
|
| 88 |
+
print(f"Sentiment: {result['sentiment']}")
|
| 89 |
+
print(f"Probabilities: {result['probabilities']}")
|
| 90 |
+
else:
|
| 91 |
+
print(f"Error: {result['error']}")
|
| 92 |
+
if "status_code" in result:
|
| 93 |
+
print(f"Status Code: {result['status_code']}")
|
| 94 |
+
if "raw_response" in result:
|
| 95 |
+
print(f"Raw Response: {result['raw_response']}")
|
model_weights.pth
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 10143071
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9edb1edb76bba91c90f595dfd0c7010160094a5e2857fdb972ce767e9e820a98
|
| 3 |
size 10143071
|