Download example.py from bbin2022/userneeds1k: direct link, hf CLI and curl.
- Browser
- Download file 428 Bytes
-
https://huggingface.co/bbin2022/userneeds1k/resolve/main/example.py
- Command line
-
hf download hf://bbin2022/userneeds1k/example.py
-
curl -L -o example.py https://huggingface.co/bbin2022/userneeds1k/resolve/main/example.py
428 Bytes
| from inference import UserNeedsClassifier | |
| model = UserNeedsClassifier() | |
| predictions = model.predict( | |
| query="How can I improve my morning exercise routine?", | |
| snippet="I want a short beginner workout that I can do at home.", | |
| ) | |
| for prediction in predictions: | |
| print( | |
| f"{prediction['score']:.4f} " | |
| f"{prediction['category_id_path']} " | |
| f"{prediction['category_path_en']}" | |
| ) | |