logo
Browse Source

update the readme.

Signed-off-by: wxywb <xy.wang@zilliz.com>
main
wxywb 2 years ago
parent
commit
ea1d912ae8
  1. 29
      README.md
  2. 0
      clip/_clip.py
  3. 2
      magic.py

29
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()
```
<img src="./cap.png" alt="result1" style="height:20px;"/>
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()
```
<img src="./tab.png" alt="result2" style="height:60px;"/>

0
clip/clip.py → clip/_clip.py

2
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()

Loading…
Cancel
Save