Update handler.py
Browse files- handler.py +5 -4
handler.py
CHANGED
|
@@ -1,14 +1,15 @@
|
|
| 1 |
from typing import Dict, List, Any
|
| 2 |
-
from transformers import GPT2Tokenizer
|
| 3 |
-
from model import GPT
|
| 4 |
import pipeline
|
| 5 |
|
| 6 |
class EndpointHandler():
|
| 7 |
def __init__(self, path=""):
|
| 8 |
# Preload all the elements you are going to need at inference.
|
| 9 |
-
model = GPT.from_pretrained(path)
|
| 10 |
-
tokenizer = GPT2Tokenizer.from_pretrained('gpt2')
|
| 11 |
# self.pipeline = pipeline("text-generation", model=model, tokenizer=tokenizer)
|
|
|
|
| 12 |
|
| 13 |
def __call__(self, data: Dict[str, Any]) -> List[Dict[str, Any]]:
|
| 14 |
"""
|
|
|
|
| 1 |
from typing import Dict, List, Any
|
| 2 |
+
# from transformers import GPT2Tokenizer
|
| 3 |
+
# from model import GPT
|
| 4 |
import pipeline
|
| 5 |
|
| 6 |
class EndpointHandler():
|
| 7 |
def __init__(self, path=""):
|
| 8 |
# Preload all the elements you are going to need at inference.
|
| 9 |
+
# model = GPT.from_pretrained(path)
|
| 10 |
+
# tokenizer = GPT2Tokenizer.from_pretrained('gpt2')
|
| 11 |
# self.pipeline = pipeline("text-generation", model=model, tokenizer=tokenizer)
|
| 12 |
+
a = 1
|
| 13 |
|
| 14 |
def __call__(self, data: Dict[str, Any]) -> List[Dict[str, Any]]:
|
| 15 |
"""
|