Spaces:
Sleeping
Sleeping
Download lambda.py from cvachet/iris_classification_lambda: direct link, hf CLI and curl.
- Browser
- Download file 656 Bytes
-
https://huggingface.co/spaces/cvachet/iris_classification_lambda/resolve/779d080d892fa44cb9b4f1a15362536d62a4fa0e/lambda.py
- Command line
-
hf download hf://spaces/cvachet/iris_classification_lambda@779d080d892fa44cb9b4f1a15362536d62a4fa0e/lambda.py
-
curl -L -o lambda.py https://huggingface.co/spaces/cvachet/iris_classification_lambda/resolve/779d080d892fa44cb9b4f1a15362536d62a4fa0e/lambda.py
656 Bytes
| from classification.classifier import Classifier | |
| import json | |
| cls = Classifier() | |
| def lambda_handler(event, context): | |
| try: | |
| # Parse the input data | |
| data = json.loads(event.get('body', '{}')) | |
| response = cls.load_and_test(data) | |
| print("Lambda response: ", response) | |
| return { | |
| 'statusCode': 200, | |
| 'body': json.dumps({ | |
| 'predictions': response["predictions"], | |
| 'probabilities': response["probabilities"] | |
| }) | |
| } | |
| except Exception as e: | |
| return { | |
| 'statusCode': 500, | |
| 'body': json.dumps({'error': str(e)}) | |
| } | |