From ea1d912ae879f2197b59c6720c14e760791bab5a Mon Sep 17 00:00:00 2001 From: wxywb Date: Thu, 2 Feb 2023 03:43:32 +0000 Subject: [PATCH] update the readme. Signed-off-by: wxywb --- README.md | 29 ++++++++++------------------- clip/{clip.py => _clip.py} | 0 magic.py | 2 +- 3 files changed, 11 insertions(+), 20 deletions(-) rename clip/{clip.py => _clip.py} (100%) diff --git a/README.md b/README.md index 8844b89..8149a7c 100644 --- a/README.md +++ b/README.md @@ -18,29 +18,20 @@ This operator generates the caption with [MAGIC](https://arxiv.org/abs/2205.0265 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 +from towhee.dc2 import pipe, ops, DataCollection -towhee.glob('./image.jpg') \ - .image_decode() \ - .image_captioning.magic(model_name='magic_mscoco') \ - .show() -``` -result1 +p = ( + pipe.input('url') + .map('url', 'img', ops.image_decode.cv2_rgb()) + .map('img', 'text', ops.image_captioning.magic(model_name='magic_mscoco')) + .output('img', 'text') +) -*Write a same pipeline with explicit inputs/outputs name specifications:* - -```python -import towhee - -towhee.glob['path']('./image.jpg') \ - .image_decode['path', 'img']() \ - .image_captioning.magic['img', 'text'](model_name='magic_mscoco') \ - .select['img', 'text']() \ - .show() -``` +DataCollection(p('./image.jpg')).show() +``` result2 diff --git a/clip/clip.py b/clip/_clip.py similarity index 100% rename from clip/clip.py rename to clip/_clip.py diff --git a/magic.py b/magic.py index d291142..5db1c21 100644 --- a/magic.py +++ b/magic.py @@ -40,7 +40,7 @@ class Magic(NNOperator): sys.path.append(path + '/clip') sys.path.append(path + '/language_model') print(sys.path) - from clip import CLIP + from _clip import CLIP from simctg import SimCTG sys.path.pop() sys.path.pop()