Pierce Maloney commited on
Commit ·
392d92f
1
Parent(s): 5e35500
returning generated ids
Browse files- handler.py +1 -1
- sample.py +1 -1
handler.py
CHANGED
|
@@ -38,7 +38,7 @@ class EndpointHandler():
|
|
| 38 |
)
|
| 39 |
|
| 40 |
generated_text = self.tokenizer.decode(generated_ids[0][input_ids.shape[1]:], skip_special_tokens=True)
|
| 41 |
-
prediction = [{"generated_text": generated_text}]
|
| 42 |
return prediction
|
| 43 |
|
| 44 |
|
|
|
|
| 38 |
)
|
| 39 |
|
| 40 |
generated_text = self.tokenizer.decode(generated_ids[0][input_ids.shape[1]:], skip_special_tokens=True)
|
| 41 |
+
prediction = [{"generated_text": generated_text, "generated_ids": generated_ids[0][input_ids.shape[1]:].tolist()}]
|
| 42 |
return prediction
|
| 43 |
|
| 44 |
|
sample.py
CHANGED
|
@@ -7,7 +7,7 @@ my_handler = EndpointHandler(path=".")
|
|
| 7 |
payload = {"inputs": "I want to turn the next page of the"}
|
| 8 |
|
| 9 |
# test the handler
|
| 10 |
-
payload=my_handler(payload
|
| 11 |
|
| 12 |
# show results
|
| 13 |
print("output:", payload)
|
|
|
|
| 7 |
payload = {"inputs": "I want to turn the next page of the"}
|
| 8 |
|
| 9 |
# test the handler
|
| 10 |
+
payload=my_handler(payload)
|
| 11 |
|
| 12 |
# show results
|
| 13 |
print("output:", payload)
|