File size: 487 Bytes
5fa1a76 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
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. |