Instructions to use dappradar/setfit-collections-multilabel with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use dappradar/setfit-collections-multilabel with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("dappradar/setfit-collections-multilabel") sentences = [ "The weather is lovely today.", "It's so sunny outside!", "He drove to the stadium." ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [3, 3] - setfit
How to use dappradar/setfit-collections-multilabel with setfit:
from setfit import SetFitModel model = SetFitModel.from_pretrained("dappradar/setfit-collections-multilabel") preds = model.predict(["i loved the spiderman movie!", "pineapple on pizza is the worst"]) print(preds) - Notebooks
- Google Colab
- Kaggle
Download test_handler.py from dappradar/setfit-collections-multilabel: direct link, hf CLI and curl.
- Browser
- Download file 345 Bytes
-
https://huggingface.co/dappradar/setfit-collections-multilabel/resolve/main/test_handler.py
- Command line
-
hf download hf://dappradar/setfit-collections-multilabel/test_handler.py
-
curl -L -o test_handler.py https://huggingface.co/dappradar/setfit-collections-multilabel/resolve/main/test_handler.py
345 Bytes
| from handler import EndpointHandler | |
| # init handler | |
| my_handler = EndpointHandler(path=".") | |
| # prepare sample payload | |
| non_holiday_payload = {"inputs": "I am quite excited how this will turn out", "date": "2022-08-08"} | |
| # test the handler | |
| non_holiday_pred=my_handler(non_holiday_payload) | |
| # show results | |
| print("non_holiday_pred", non_holiday_pred) |