Update README.md
Browse files
README.md
CHANGED
@@ -129,7 +129,7 @@ To load the model:
|
|
129 |
```python
|
130 |
import uform
|
131 |
|
132 |
-
model = uform.get_model('unum-cloud/uform-vl-multilingual-v2')
|
133 |
```
|
134 |
|
135 |
To encode data:
|
@@ -140,11 +140,11 @@ from PIL import Image
|
|
140 |
text = 'a small red panda in a zoo'
|
141 |
image = Image.open('red_panda.jpg')
|
142 |
|
143 |
-
image_data =
|
144 |
-
text_data =
|
145 |
|
146 |
-
image_embedding = model.encode_image(image_data)
|
147 |
-
text_embedding = model.encode_text(text_data)
|
148 |
joint_embedding = model.encode_multimodal(image=image_data, text=text_data)
|
149 |
```
|
150 |
|
|
|
129 |
```python
|
130 |
import uform
|
131 |
|
132 |
+
model, processor = uform.get_model('unum-cloud/uform-vl-multilingual-v2')
|
133 |
```
|
134 |
|
135 |
To encode data:
|
|
|
140 |
text = 'a small red panda in a zoo'
|
141 |
image = Image.open('red_panda.jpg')
|
142 |
|
143 |
+
image_data = processor.preprocess_image(image)
|
144 |
+
text_data = processor.preprocess_text(text)
|
145 |
|
146 |
+
image_features, image_embedding = model.encode_image(image_data, return_features=True)
|
147 |
+
text_features, text_embedding = model.encode_text(text_data, return_features=True)
|
148 |
joint_embedding = model.encode_multimodal(image=image_data, text=text_data)
|
149 |
```
|
150 |
|