Simple call on one item: | |
thon | |
pipe = pipeline("text-classification") | |
pipe("This restaurant is awesome") | |
[{'label': 'POSITIVE', 'score': 0.9998743534088135}] | |
If you want to use a specific model from the hub you can ignore the task if the model on | |
the hub already defines it: | |
thon | |
pipe = pipeline(model="FacebookAI/roberta-large-mnli") | |
pipe("This restaurant is awesome") | |
[{'label': 'NEUTRAL', 'score': 0.7313136458396912}] | |
To call a pipeline on many items, you can call it with a list. |