logo
Browse Source

update the readme.

Signed-off-by: wxywb <xy.wang@zilliz.com>
main
wxywb 2 years ago
parent
commit
c06b5cd439
  1. 42
      README.md

42
README.md

@ -21,39 +21,29 @@ Load an image from path './teddy.jpg' to generate an image embedding.
Read the text 'A teddybear on a skateboard in Times Square.' to generate an text embedding.
*Write the pipeline in simplified style*:
*Write a pipeline with explicit inputs/outputs name specifications:*
```python
import towhee
towhee.glob('./teddy.jpg') \
.image_decode() \
.image_text_embedding.lightningdot(model_name='lightningdot_base', modality='image') \
.show()
from towhee.dc2 import pipe, ops, DataCollection
towhee.dc(["A teddybear on a skateboard in Times Square."]) \
.image_text_embedding.lightningdot(model_name='lightningdot_base', modality='text') \
.show()
```
<img src="https://towhee.io/image-text-embedding/lightningdot/raw/branch/main/vec1.png" alt="result1" style="height:20px;"/>
<img src="https://towhee.io/image-text-embedding/lightningdot/raw/branch/main/vec2.png" alt="result2" style="height:20px;"/>
img_pipe = (
pipe.input('url')
.map('url', 'img', ops.image_decode.cv2_rgb())
.map('img', 'vec', ops.image_text_embedding.lightningdot(model_name='lightningdot_base', modality='image'))
.output('img', 'vec')
)
*Write a same pipeline with explicit inputs/outputs name specifications:*
text_pipe = (
pipe.input('text')
.map('text', 'vec', ops.image_text_embedding.lightningdot(model_name='lightningdot_base', modality='text'))
.output('text', 'vec')
)
```python
import towhee
towhee.glob['path']('./teddy.jpg') \
.image_decode['path', 'img']() \
.image_text_embedding.lightningdot['img', 'vec'](model_name='lightningdot_base', modality='image') \
.select['img', 'vec']() \
.show()
towhee.dc['text'](["A teddybear on a skateboard in Times Square."]) \
.image_text_embedding.lightningdot['text','vec'](model_name='lightningdot_base', modality='text') \
.select['text', 'vec']() \
.show()
DataCollection(img_pipe('./teddy.jpg')).show()
DataCollection(text_pipe('A teddybear on a skateboard in Times Square.')).show()
```
<img src="https://towhee.io/image-text-embedding/lightningdot/raw/branch/main/tabular1.png" alt="result1" style="height:60px;"/>
<img src="https://towhee.io/image-text-embedding/lightningdot/raw/branch/main/tabular2.png" alt="result2" style="height:60px;"/>

Loading…
Cancel
Save