Update pipeline.py
Browse files- pipeline.py +1 -3
pipeline.py
CHANGED
@@ -34,10 +34,8 @@ class PreTrainedPipeline():
|
|
34 |
{"feature_vector": [0.6331314444541931,...,-0.7866355180740356,]} containing :
|
35 |
- "feature_vector": A list of floats corresponding to the image embedding.
|
36 |
"""
|
37 |
-
inputs = data.pop("inputs", data)
|
38 |
-
|
39 |
# decode base64 image to PIL
|
40 |
-
image = PIL.Image.open(io.BytesIO(base64.b64decode(
|
41 |
inputs = self.processor(images=image, return_tensors="pt")
|
42 |
outputs = self.model(**inputs)
|
43 |
feature_vector = outputs.last_hidden_state[0, 0].tolist()
|
|
|
34 |
{"feature_vector": [0.6331314444541931,...,-0.7866355180740356,]} containing :
|
35 |
- "feature_vector": A list of floats corresponding to the image embedding.
|
36 |
"""
|
|
|
|
|
37 |
# decode base64 image to PIL
|
38 |
+
image = PIL.Image.open(io.BytesIO(base64.b64decode(data)))
|
39 |
inputs = self.processor(images=image, return_tensors="pt")
|
40 |
outputs = self.model(**inputs)
|
41 |
feature_vector = outputs.last_hidden_state[0, 0].tolist()
|