Browse Source
update the readme.
Signed-off-by: wxywb <xy.wang@zilliz.com>
main
wxywb
2 years ago
1 changed files with
9 additions and
18 deletions
-
README.md
|
|
@ -19,28 +19,19 @@ This operator generates the caption with [BLIP](https://arxiv.org/abs/2201.12086 |
|
|
|
|
|
|
|
Load an image from path './animals.jpg' to generate the caption. |
|
|
|
|
|
|
|
*Write the pipeline in simplified style*: |
|
|
|
*Write a pipeline with explicit inputs/outputs name specifications:* |
|
|
|
|
|
|
|
```python |
|
|
|
import towhee |
|
|
|
from towhee.dc2 import pipe, ops, DataCollection |
|
|
|
|
|
|
|
towhee.glob('./animals.jpg') \ |
|
|
|
.image_decode() \ |
|
|
|
.image_captioning.blip(model_name='blip_base') \ |
|
|
|
.show() |
|
|
|
``` |
|
|
|
<img src="./cap.png" alt="result1" style="height:20px;"/> |
|
|
|
|
|
|
|
*Write a same pipeline with explicit inputs/outputs name specifications:* |
|
|
|
|
|
|
|
```python |
|
|
|
import towhee |
|
|
|
p = ( |
|
|
|
pipe.input('url') |
|
|
|
.map('url', 'img', ops.image_decode.cv2_rgb()) |
|
|
|
.map('img', 'text', ops.image_captioning.blip(model_name='blip_base')) |
|
|
|
.output('img', 'text') |
|
|
|
) |
|
|
|
|
|
|
|
towhee.glob['path']('./animals.jpg') \ |
|
|
|
.image_decode['path', 'img']() \ |
|
|
|
.image_captioning.blip['img', 'text'](model_name='blip_base') \ |
|
|
|
.select['img', 'text']() \ |
|
|
|
.show() |
|
|
|
DataCollection(p('./animals.jpg')).show() |
|
|
|
``` |
|
|
|
<img src="./tabular.png" alt="result2" style="height:60px;"/> |
|
|
|
|
|
|
|