Spaces:
Sleeping
Sleeping
Download tests/test_classifier.py from cvachet/iris_classification_lambda: direct link, hf CLI and curl.
- Browser
- Download file 745 Bytes
-
https://huggingface.co/spaces/cvachet/iris_classification_lambda/resolve/ca264b805ee53904e39b2c466fcf00d50b1c249e/tests/test_classifier.py
- Command line
-
hf download hf://spaces/cvachet/iris_classification_lambda@ca264b805ee53904e39b2c466fcf00d50b1c249e/tests/test_classifier.py
-
curl -L -o test_classifier.py https://huggingface.co/spaces/cvachet/iris_classification_lambda/resolve/ca264b805ee53904e39b2c466fcf00d50b1c249e/tests/test_classifier.py
745 Bytes
| """ | |
| Testing Classifier module | |
| """ | |
| import pytest | |
| from classification.classifier import Classifier | |
| def setup_pipeline(): | |
| """Setup classifier pipeline - training classifier and saving model""" | |
| pipeline = Classifier() | |
| pipeline.train_and_save() | |
| return pipeline | |
| def requests(): | |
| """Example dataset""" | |
| return {"features": [[6.5, 3.0, 5.8, 2.2], [6.1, 2.8, 4.7, 1.2]]} | |
| def response(): | |
| """Ground truth response from classifier""" | |
| return ["virginica", "versicolor"] | |
| def test_response(setup_pipeline, requests, response): | |
| """Tests if classifier returns correct prediction""" | |
| assert response == setup_pipeline.load_and_test(requests["features"])["predictions"] | |