Samin7479 commited on
Commit
ed3530e
·
1 Parent(s): ef933ef

Corrected code

Browse files
Files changed (2) hide show
  1. TestAPI.py +19 -19
  2. model_weights.pth +1 -1
TestAPI.py CHANGED
@@ -3,7 +3,7 @@ import json
3
  import os
4
 
5
 
6
- ROOT_API = "https://masumbhuiyan-myabsaservice.hf.space"
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
- # 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']}")
 
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:aa13dcf62b073002408dc916361923814df3d28f1afc4aa7efc67488cc405a82
3
  size 10143071
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9edb1edb76bba91c90f595dfd0c7010160094a5e2857fdb972ce767e9e820a98
3
  size 10143071