Spaces:
Sleeping
Sleeping
Download main.py from cvachet/iris_classification_lambda: direct link, hf CLI and curl.
- Browser
- Download file 644 Bytes
-
https://huggingface.co/spaces/cvachet/iris_classification_lambda/resolve/03e6a2fc22e5e6d6a3109ca0c78e93b49c4e6efa/main.py
- Command line
-
hf download hf://spaces/cvachet/iris_classification_lambda@03e6a2fc22e5e6d6a3109ca0c78e93b49c4e6efa/main.py
-
curl -L -o main.py https://huggingface.co/spaces/cvachet/iris_classification_lambda/resolve/03e6a2fc22e5e6d6a3109ca0c78e93b49c4e6efa/main.py
644 Bytes
| from classification.classifier import Classifier | |
| import json | |
| if __name__ == "__main__": | |
| cls = Classifier() | |
| # Training | |
| cls.train_and_save() | |
| # Testing | |
| data = { | |
| "features": [[6.5, 3.0, 5.8, 2.2],[6.1, 2.8, 4.7, 1.2]] | |
| } | |
| features = data["features"] | |
| results = cls.load_and_test(features) | |
| print("results:", results) | |
| # Response similar to REST API call | |
| response = { | |
| 'statusCode': 200, | |
| 'body': json.dumps({ | |
| 'predictions': results["predictions"], | |
| 'probabilities': results["probabilities"] | |
| }) | |
| } | |
| print("Example REST API response: ", response) | |