Commit
·
1e71dbb
1
Parent(s):
3b6df47
Update handler.py
Browse files- handler.py +2 -2
handler.py
CHANGED
|
@@ -24,8 +24,8 @@ device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
|
| 24 |
class EndpointHandler:
|
| 25 |
def __init__(self, path=""):
|
| 26 |
# load model and processor from path
|
| 27 |
-
self.model = LayoutLMForTokenClassification.from_pretrained(
|
| 28 |
-
self.processor = LayoutLMv2Processor.from_pretrained(
|
| 29 |
|
| 30 |
def __call__(self, data: Dict[str, bytes]) -> Dict[str, List[Any]]:
|
| 31 |
"""
|
|
|
|
| 24 |
class EndpointHandler:
|
| 25 |
def __init__(self, path=""):
|
| 26 |
# load model and processor from path
|
| 27 |
+
self.model = LayoutLMForTokenClassification.from_pretrained(path).to(device)
|
| 28 |
+
self.processor = LayoutLMv2Processor.from_pretrained(path)
|
| 29 |
|
| 30 |
def __call__(self, data: Dict[str, bytes]) -> Dict[str, List[Any]]:
|
| 31 |
"""
|