Download tests.py from snorkelai/instruction-response-quality: direct link, hf CLI and curl.
- Browser
- Download file 1.26 kB
-
https://huggingface.co/snorkelai/instruction-response-quality/resolve/main/tests.py
- Command line
-
hf download hf://snorkelai/instruction-response-quality/tests.py
-
curl -L -o tests.py https://huggingface.co/snorkelai/instruction-response-quality/resolve/main/tests.py
1.26 kB
| from handler import EndpointHandler | |
| import pandas as pd | |
| # init handler | |
| response_model_handler = EndpointHandler() | |
| # prepare sample payload | |
| payload = {'inputs': {"instruction": "What are some ways to stay energized throughout the day?", | |
| "response": "Drink lots of coffee!"}} | |
| # test the handler | |
| pred=response_model_handler(payload) | |
| print(pred) | |
| payload = {'inputs': [{"instruction": "What are some ways to stay energized throughout the day?", | |
| "response": "Drink lots of coffee!", | |
| "dataset": ''}, | |
| {"instruction": "What are some ways to stay energized throughout the day?", | |
| "response": "Drink lots of coffee!", | |
| "dataset": 'dolly'}, | |
| {"instruction": "What are some ways to stay energized throughout the day?", | |
| "response": "Drink lots of coffee!", | |
| "dataset": 'open-assistant'}, | |
| {"instruction": "What are some ways to stay energized throughout the day?", | |
| "response": "Drink lots of coffee!", | |
| "dataset": 'helpful_instructions'}]} | |
| # test the handler | |
| pred=response_model_handler(payload) | |
| print(pred) |