diff --git a/README.md b/README.md index 41ce102..e0a056a 100644 --- a/README.md +++ b/README.md @@ -17,18 +17,24 @@ This operator is implemented with pre-trained models from [Huggingface Transform Use the pre-trained model 'distilbert-base-cased' to generate a text embedding for the sentence "Hello, world.". -*Write the pipeline*: +*Write a same pipeline with explicit inputs/outputs name specifications:* +- **option 1 (towhee>=0.9.0):** ```python -import towhee +from towhee.dc2 import pipe, ops, DataCollection -( - towhee.dc(["Hello, world."]) - .text_embedding.transformers(model_name="distilbert-base-cased") +p = ( + pipe.input('text') + .map('text', 'vec', ops.text_embedding.transformers(model_name='distilbert-base-cased')) + .output('text', 'vec') ) + +DataCollection(p('Hello, world.')).show() ``` -*Write a same pipeline with explicit inputs/outputs name specifications:* + + +- **option 2:** ```python import towhee @@ -40,8 +46,6 @@ import towhee ) ``` - -
## Factory Constructor