Update pipeline.py
Browse files- pipeline.py +3 -3
pipeline.py
CHANGED
|
@@ -42,11 +42,11 @@ 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
|
| 46 |
-
parameters =
|
| 47 |
|
| 48 |
# decode base64 image to PIL
|
| 49 |
-
image = Image.open(BytesIO(base64.b64decode(inputs
|
| 50 |
image = self.transform(image).unsqueeze(0).to(device)
|
| 51 |
text=""
|
| 52 |
with torch.no_grad():
|
|
|
|
| 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)
|
| 51 |
text=""
|
| 52 |
with torch.no_grad():
|