diff --git a/README.md b/README.md index 5c88350..e5bbc81 100644 --- a/README.md +++ b/README.md @@ -18,28 +18,18 @@ This operator generates the caption with [ExpansionNet v2](https://arxiv.org/abs Load an image from path './image.jpg' to generate the caption. - *Write the pipeline in simplified style*: - +*Write a pipeline with explicit inputs/outputs name specifications:* ```python -import towhee - -towhee.glob('./image.jpg') \ - .image_decode() \ - .image_captioning.expansionnet_v2(model_name='expansionnet_rf') \ - .show() -``` -result1 +from towhee.dc2 import pipe, ops, DataCollection -*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.expansionnet_v2(model_name='expansionnet_rf')) + .output('img', 'text') +) -towhee.glob['path']('./image.jpg') \ - .image_decode['path', 'img']() \ - .image_captioning.expansionnet_v2['img', 'text'](model_name='expansionnet_rf') \ - .select['img', 'text']() \ - .show() +DataCollection(p('./image.jpg')).show() ``` result2