Commit
·
a187ce5
1
Parent(s):
9514282
Update pipeline.py
Browse files- pipeline.py +2 -19
pipeline.py
CHANGED
@@ -26,29 +26,12 @@ class PreTrainedPipeline():
|
|
26 |
|
27 |
self.id2label = config["id2label"]
|
28 |
|
29 |
-
def __call__(self, inputs:
|
30 |
|
31 |
-
"""
|
32 |
-
|
33 |
-
Args:
|
34 |
-
|
35 |
-
inputs (:obj:`PIL.Image`):
|
36 |
-
|
37 |
-
The raw image representation as PIL.
|
38 |
-
|
39 |
-
No transformation made whatsoever from the input. Make all necessary transformations here.
|
40 |
-
|
41 |
-
Return:
|
42 |
-
|
43 |
-
A :obj:`list`:. The list contains items that are dicts should be liked {"label": "XXX", "score": 0.82}
|
44 |
-
|
45 |
-
It is preferred if the returned list is in decreasing `score` order
|
46 |
-
|
47 |
-
"""
|
48 |
|
49 |
# IMPLEMENT_THIS
|
50 |
|
51 |
-
|
52 |
|
53 |
_, _, preds = self.model.predict(inputs)
|
54 |
|
|
|
26 |
|
27 |
self.id2label = config["id2label"]
|
28 |
|
29 |
+
def __call__(self, inputs: str) -> List[Dict[str, Any]]:
|
30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
|
32 |
# IMPLEMENT_THIS
|
33 |
|
34 |
+
|
35 |
|
36 |
_, _, preds = self.model.predict(inputs)
|
37 |
|