Download handler.py from uyen1109/elliptic-fraud-deploy: direct link, hf CLI and curl.
- Browser
- Download file 550 Bytes
-
https://huggingface.co/uyen1109/elliptic-fraud-deploy/resolve/main/handler.py
- Command line
-
hf download hf://uyen1109/elliptic-fraud-deploy/handler.py
-
curl -L -o handler.py https://huggingface.co/uyen1109/elliptic-fraud-deploy/resolve/main/handler.py
550 Bytes
| from typing import Any, Dict | |
| import os | |
| from src.elliptic_fraud.predictor import FraudPredictor | |
| class EndpointHandler: | |
| def __init__(self, path: str = "."): | |
| default_in = int(os.environ.get("IN_FEATURES", "4")) | |
| model_type = os.environ.get("MODEL_TYPE", "mlp") | |
| ckpt = os.environ.get("CKPT_PATH", "") | |
| self.predictor = FraudPredictor(default_in_features=default_in, model_type=model_type, ckpt_path=ckpt) | |
| def __call__(self, inputs: Dict[str, Any]) -> Dict[str, Any]: | |
| return self.predictor.predict(inputs) | |