From 2c1c90998e96fbea447d2c911741bbfe2deda328 Mon Sep 17 00:00:00 2001 From: wxywb Date: Thu, 2 Feb 2023 07:27:21 +0000 Subject: [PATCH] update the readme. Signed-off-by: wxywb --- README.md | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) 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