Views
No views yet
32 total examples (8 per class).1***** Running evaluation *****
2model used: sentence-transformers/all-mpnet-base-v2
3train dataset: 32 samples
4accuracy: 0.8731578947368421handler.py as an example for how to use SetFit models with inference-endpoints.pip install requests)1import json
2import requests as r
3
4ENDPOINT_URL=""# url of your endpoint
5HF_TOKEN=""
6
7# payload samples
8regular_payload = { "inputs": "Coming to The Rescue Got a unique problem? Not to worry: you can find a financial planner for every specialized need"}
9
10# HTTP headers for authorization
11headers= {
12 "Authorization": f"Bearer {HF_TOKEN}",
13 "Content-Type": "application/json"
14}
15
16# send request
17response = r.post(ENDPOINT_URL, headers=headers, json=paramter_payload)
18classified = response.json()
19
20print(classified)
21# [ { "label": "World", "score": 0.12341519122860946 }, { "label": "Sports", "score": 0.11741269832494523 }, { "label": "Business", "score": 0.6124446065942992 }, { "label": "Sci/Tech", "score": 0.14672750385214603 } ]1curl https://YOURDOMAIN.us-east-1.aws.endpoints.huggingface.cloud \
2-X POST \
3-d '{"inputs": "Coming to The Rescue Got a unique problem? Not to worry: you can find a financial planner for every specialized need"}' \
4-H "Authorization: Bearer XXX" \
5-H "Content-Type: application/json"