diff --git a/README.md b/README.md index 931ac27..621cce3 100644 --- a/README.md +++ b/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() -``` -result1 - -*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() ``` result2