Update pipeline.py
Browse files- pipeline.py +1 -3
pipeline.py
CHANGED
|
@@ -33,7 +33,7 @@ class PreTrainedPipeline():
|
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
-
def __call__(self,
|
| 37 |
"""
|
| 38 |
Args:
|
| 39 |
data (:obj:):
|
|
@@ -42,9 +42,7 @@ class PreTrainedPipeline():
|
|
| 42 |
A :obj:`dict`:. The object returned should be a dict like {"feature_vector": [0.6331314444541931,0.8802216053009033,...,-0.7866355180740356,]} containing :
|
| 43 |
- "feature_vector": A list of floats corresponding to the image embedding.
|
| 44 |
"""
|
| 45 |
-
inputs = data["inputs"]
|
| 46 |
parameters = {"mode": "image"}
|
| 47 |
-
|
| 48 |
# decode base64 image to PIL
|
| 49 |
image = Image.open(BytesIO(base64.b64decode(inputs)))
|
| 50 |
image = self.transform(image).unsqueeze(0).to(device)
|
|
|
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
+
def __call__(self, inputs: str) -> List[float]:
|
| 37 |
"""
|
| 38 |
Args:
|
| 39 |
data (:obj:):
|
|
|
|
| 42 |
A :obj:`dict`:. The object returned should be a dict like {"feature_vector": [0.6331314444541931,0.8802216053009033,...,-0.7866355180740356,]} containing :
|
| 43 |
- "feature_vector": A list of floats corresponding to the image embedding.
|
| 44 |
"""
|
|
|
|
| 45 |
parameters = {"mode": "image"}
|
|
|
|
| 46 |
# decode base64 image to PIL
|
| 47 |
image = Image.open(BytesIO(base64.b64decode(inputs)))
|
| 48 |
image = self.transform(image).unsqueeze(0).to(device)
|