Update pipeline.py
Browse files- pipeline.py +4 -0
pipeline.py
CHANGED
@@ -5,18 +5,22 @@ import os
|
|
5 |
import json
|
6 |
import numpy as np
|
7 |
|
|
|
|
|
8 |
class PreTrainedPipeline:
|
9 |
def __init__(self, path=""):
|
10 |
# IMPLEMENT_THIS
|
11 |
# Preload all the elements you are going to need at inference.
|
12 |
# For instance your model, processors, tokenizer that might be needed.
|
13 |
# This function is only called once, so do all the heavy processing I/O here"""
|
|
|
14 |
self.model = load_learner(os.path.join(path, "model.pkl"))
|
15 |
with open(os.path.join(path, "config.json")) as config:
|
16 |
config = json.load(config)
|
17 |
self.labels = config["labels"]
|
18 |
|
19 |
def __call__(self, inputs: "Image.Image") -> List[Dict[str, Any]]:
|
|
|
20 |
"""
|
21 |
Args:
|
22 |
inputs (:obj:`PIL.Image`):
|
|
|
5 |
import json
|
6 |
import numpy as np
|
7 |
|
8 |
+
print('PIPELINE')
|
9 |
+
|
10 |
class PreTrainedPipeline:
|
11 |
def __init__(self, path=""):
|
12 |
# IMPLEMENT_THIS
|
13 |
# Preload all the elements you are going to need at inference.
|
14 |
# For instance your model, processors, tokenizer that might be needed.
|
15 |
# This function is only called once, so do all the heavy processing I/O here"""
|
16 |
+
print('init')
|
17 |
self.model = load_learner(os.path.join(path, "model.pkl"))
|
18 |
with open(os.path.join(path, "config.json")) as config:
|
19 |
config = json.load(config)
|
20 |
self.labels = config["labels"]
|
21 |
|
22 |
def __call__(self, inputs: "Image.Image") -> List[Dict[str, Any]]:
|
23 |
+
print('call')
|
24 |
"""
|
25 |
Args:
|
26 |
inputs (:obj:`PIL.Image`):
|