update handler
Browse files- handler.py +2 -7
handler.py
CHANGED
@@ -1,4 +1,3 @@
|
|
1 |
-
from typing import Dict, List, Any
|
2 |
from transformers import LayoutLMForTokenClassification, LayoutLMv2Processor, PegasusForConditionalGeneration, AlbertTokenizer
|
3 |
import torch
|
4 |
|
@@ -11,12 +10,8 @@ class EndpointHandler():
|
|
11 |
self.model = PegasusForConditionalGeneration.from_pretrained(model_id).to(device)
|
12 |
self.tokenizer = AlbertTokenizer.from_pretrained(model_id)
|
13 |
|
14 |
-
def __call__(self, data
|
15 |
-
|
16 |
-
Args:
|
17 |
-
data (:obj:):
|
18 |
-
includes the deserialized image file as PIL.Image
|
19 |
-
"""
|
20 |
# process input
|
21 |
wrongSentence = data.pop("inputs", data)
|
22 |
|
|
|
|
|
1 |
from transformers import LayoutLMForTokenClassification, LayoutLMv2Processor, PegasusForConditionalGeneration, AlbertTokenizer
|
2 |
import torch
|
3 |
|
|
|
10 |
self.model = PegasusForConditionalGeneration.from_pretrained(model_id).to(device)
|
11 |
self.tokenizer = AlbertTokenizer.from_pretrained(model_id)
|
12 |
|
13 |
+
def __call__(self, data):
|
14 |
+
|
|
|
|
|
|
|
|
|
15 |
# process input
|
16 |
wrongSentence = data.pop("inputs", data)
|
17 |
|