Nick Sorros
commited on
Commit
·
da5a2e2
1
Parent(s):
6d3d5fc
Fix handler
Browse files- handler.py +3 -3
handler.py
CHANGED
|
@@ -18,9 +18,9 @@ class EndpointHandler():
|
|
| 18 |
- "label": A string representing what the label/class is. There can be multiple labels.
|
| 19 |
- "score": A score between 0 and 1 describing how confident the model is for this label/class.
|
| 20 |
"""
|
| 21 |
-
|
| 22 |
-
inputs = self.tokenizer(
|
| 23 |
-
preds = self.model(
|
| 24 |
|
| 25 |
with open("label_binarizer.pkl", "rb") as f:
|
| 26 |
label_binarizer = pickle.loads(f.read())
|
|
|
|
| 18 |
- "label": A string representing what the label/class is. There can be multiple labels.
|
| 19 |
- "score": A score between 0 and 1 describing how confident the model is for this label/class.
|
| 20 |
"""
|
| 21 |
+
text = data.pop("inputs", data)
|
| 22 |
+
inputs = self.tokenizer(text, padding="max_length")
|
| 23 |
+
preds = self.model(input_ids=[inputs["input_ids"]])
|
| 24 |
|
| 25 |
with open("label_binarizer.pkl", "rb") as f:
|
| 26 |
label_binarizer = pickle.loads(f.read())
|