Spaces:
Sleeping
Sleeping
File size: 667 Bytes
9ecca49 3d24ae9 9ecca49 3d24ae9 9ecca49 f4e0e4a 3d24ae9 5c0db05 3d24ae9 9ecca49 3d24ae9 5c0db05 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
"""
Direct inference with hard-coded data
"""
import json
from classification.classifier import Classifier
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)
|