lingdoc commited on
Commit
0c8e556
·
verified ·
1 Parent(s): be2d1ce

Updated API code

Browse files
Files changed (1) hide show
  1. README.md +3 -5
README.md CHANGED
@@ -74,13 +74,11 @@ data = {"inputs": prompt, "parameters": {"top_k": 3}}
74
 
75
  response = requests.request("POST", api_url, headers=headers, json=data)
76
 
77
- # The labels are arranged according to likelihood of classification
78
- repdict = {"LABEL_0": "Pow", "LABEL_1": "Ach", "LABEL_2": "Aff"}
79
- # so we replace them in the output
80
- scores = {repdict[x['label']]: x['score'] for x in response.json()}
81
  print(scores)
82
 
83
- # output: {'Pow': 0.8279141187667847, 'Aff': 0.7250356674194336, 'Ach': 0.0020263446494936943}
84
  ```
85
 
86
  ## References
 
74
 
75
  response = requests.request("POST", api_url, headers=headers, json=data)
76
 
77
+ # Print the labels and scores (arranged in order of likelihood)
78
+ scores = {x['label']: x['score'] for x in response.json()}
 
 
79
  print(scores)
80
 
81
+ # {'Aff': 0.999998927116394, 'Pow': 0.999890923500061, 'Ach': 5.351924119167961e-05}
82
  ```
83
 
84
  ## References