diff --git a/README.md b/README.md index 0034355..77291f6 100644 --- a/README.md +++ b/README.md @@ -19,27 +19,19 @@ Use the pre-trained model "microsoft/unixcoder-base" to generate text embeddings for given text description "return max value" and code "def max(a,b): if a>b: return a else return b". -*Write the pipeline*: +*Write a pipeline with explicit inputs/outputs name specifications:* ```python -import towhee +from towhee.dc2 import pipe, ops, DataCollection -( - towhee.dc(['find max value', 'def max(a,b): if a>b: return a else return b']) - .code_search.unixcoder(model_name='microsoft/unixcoder-base') +p = ( + pipe.input('text') + .map('text', 'embedding', ops.code_search.unixcoder()) + .output('text', 'embedding') ) -``` - -*Write a same pipeline with explicit inputs/outputs name specifications:* -```python -import towhee - -( - towhee.dc['text'](['return max value', 'def max(a,b): if a>b: return a else return b']) - .code_search.unixcoder['text', 'embedding']() - .show() -) +DataCollection(p('find max value')).show() +DataCollection(p('def max(a,b): if a>b: return a else return b')).show() ``` diff --git a/result.png b/result.png index 1b767b8..b442d85 100644 Binary files a/result.png and b/result.png differ